Welcome! Log In Create A New Profile

Advanced

Nginx seems to ignore proxy_set_header Host directive

February 11, 2013 10:44AM
Hi all

I am trying to use nginx to get remote access to various service on my home server, via proxy_pass redirection to various subdirectorys

For example, owncloud server with apache, pyload with it's builtin http server, xbmc web interface, ...

I access the webserver via a static IP adress, and not via a domain name.

Here's a simple conf file for nginx.


########################################################
server {
listen 80; ## listen for ipv4; this line is default and implied

root /hdd/www;
index index.html index.htm;

server_name localhost;

location /pyload/ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://192.168.1.100:8001/;
}
}
########################################################

I think this setup would be straighforward, but for some reason, all relative path are not rewriten and I get 502 error for all images, css and js file.

I would be very grateful if someone had a clue to help me understanding what I am doing wrong.

Regards
SubjectAuthorPosted

Nginx seems to ignore proxy_set_header Host directive

jeangouytchFebruary 11, 2013 10:44AM

Re: Nginx seems to ignore proxy_set_header Host directive

Francis DalyFebruary 11, 2013 02:10PM

Re: Nginx seems to ignore proxy_set_header Host directive

jeangouytchFebruary 11, 2013 04:13PM

Re: Nginx seems to ignore proxy_set_header Host directive

Francis DalyFebruary 11, 2013 04:44PM

Re: Nginx seems to ignore proxy_set_header Host directive

jeangouytchFebruary 12, 2013 02:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 165 on April 21, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready