Francis Daly
February 11, 2013 02:10PM
On Mon, Feb 11, 2013 at 10:44:03AM -0500, jeangouytch wrote:

Hi there,

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

That's fairly standard. Although having different levels of subdirectories
on the proxied and the proxy servers usually gets messy, unless the
proxied server is very careful.

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

The "listen" and "server_name" directives determine which "server"
is used for each request. So using an IP address is fine, so long as
things are set correctly.

(The easy way to ensure that, is to have exactly one server{} block.)

> 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.

Which relative paths? How do you want them to be rewritten?

What part of the nginx config do you expect will do the rewriting?

And how does that match the subject of this mail?

proxy_redirect (http://nginx.org/r/proxy_redirect) can do rewriting of
http headers, except you've turned it off here.

proxy_set_header doesn't do rewriting of anything. Neither does
proxy_pass.

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

Can you give an example of what you do, what you see, and what you
expect to see? "curl -i" is usually a good way of showing the headers
and content returned.

(*Usually*, it's best if nginx does not mess with the content. You can
look at http://nginx.org/r/sub_filter if you think you want to change
the content.)

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx seems to ignore proxy_set_header Host directive

jeangouytch February 11, 2013 10:44AM

Re: Nginx seems to ignore proxy_set_header Host directive

Francis Daly February 11, 2013 02:10PM

Re: Nginx seems to ignore proxy_set_header Host directive

jeangouytch February 11, 2013 04:13PM

Re: Nginx seems to ignore proxy_set_header Host directive

Francis Daly February 11, 2013 04:44PM

Re: Nginx seems to ignore proxy_set_header Host directive

jeangouytch February 12, 2013 02:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready