LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-29-2017, 04:12 PM   #1
Boucane
LQ Newbie
 
Registered: Dec 2008
Location: Montreal
Distribution: Suse, Ubuntu, Debian
Posts: 11

Rep: Reputation: 4
nginx proxy_pass node js app


I have a nginx server setup as a proxy to a node js app using this config


Quote:
upstream app_nodejs {
server 127.0.0.1:8080;
}

server {
listen 80 default;
server_name toto.example.com;

root /www/apps/myapp;
index index.html;

location / {

proxy_http_version 1.1;
proxy_set_header Connection "";

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://app_nodejs;
proxy_pass_header Accept;
proxy_pass_header Server;
proxy_redirect off;
}

}
The problem I have is that I don't receive a valid HTTP Header from nginx. the Status-Line is missing and the Server line is missing.

When a curl -I the backend upstream server app_nodejs, I receive a correct header.

Any idea why?
 
Old 04-04-2017, 10:31 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
I thought if you had proxy_set_header then it does not pass the original header through. Maybe post what you are actually getting at nginx and node.js?

Last edited by smallpond; 04-04-2017 at 10:37 AM.
 
Old 04-05-2017, 09:29 AM   #3
Boucane
LQ Newbie
 
Registered: Dec 2008
Location: Montreal
Distribution: Suse, Ubuntu, Debian
Posts: 11

Original Poster
Rep: Reputation: 4
nodejs
If I make a curl call to the backend upstream server, I receive the HTTP Status-Line


Quote:
# curl -I 127.0.0.1:8080
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding:
Date: Wed, 05 Apr 2017 14:22:00 GMT
Connection: keep-alive
nginx
If I make a curl call to the nginx server, I don't receive the HTTP Status-Line

Quote:
# curl -I 127.0.0.1:80
Content-Type: text/plain
Transfer-Encoding:
Date: Wed, 05 Apr 2017 14:23:14 GMT
Connection: keep-alive
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to deploy Node.js Applications with pm2 and Nginx on Ubuntu LXer Syndicated Linux News 0 03-20-2017 07:29 PM
App is moved to different NUMA node, how is shared memory handled? mbrose1994 Linux - Software 1 01-24-2017 07:05 PM
LXer: Google debuts Node.js beta on its App Engine LXer Syndicated Linux News 0 03-23-2016 02:02 AM
Nginx and node.js create proxy server thuananh Linux - Newbie 0 06-04-2012 04:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration