trying to get something like proxypassreverse going.
nginx-forum at nginx.us
Sat Aug 21 10:45:47 MSD 2010
Hey guys I hate to bump my own post but.....
I am still struggling to get this proxy going. I have followed example
after example on the web and nothing seems to work. I have also read
through the documentation on proxy_pass and proxy_redirect but I still
can't make it work.
What I am trying to do is pretty simple I think and surely this is a
Here is the situation.
I have a rails site. Initially I was serving with passenger but I
changed it to a proxy because I thought maybe passenger was causing a
problem. I am now using nginx without the passenger module.
The main web site is being served from the backend http://localhost:3001
This part works great. I can go to my.server.com and I get the web site
I am expecting.
I want anything in the /foo path to be handled by backend
http://localhost:3000 This almost works. Then I browse
http://my.server.com/foo it sends the request to the proper backend but
the stylesheets, images etc don't load. The reason is because the links
from the backend point to /stylesheets, /images etc and nginx is not
Somehow I need nginx to append /foo to /stylesheets when they come from
According to the documantation the proxy redirect is supposed to do this
but I can't find the magic incantation. The documentation says ...
Let us suppose the proxied server returned line Location:
proxy_redirect http://localhost:8000/two/ http://frontend/one/;
will rewrite this line in the form Location:
In the replaceable line it is possible not to indicate the name of the
proxy_redirect http://localhost:8000/two/ /;
then the basic name of server and port is set, if it is different from
I tried this but I still can't make it work.
Surely there is an easy way to this pretty simple thing.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,121239,122018#msg-122018
More information about the nginx