nginx proxy pass redirects ignore port
Posted
by
Paul
on Server Fault
See other posts from Server Fault
or by Paul
Published on 2012-02-23T20:20:57Z
Indexed on
2012/03/27
23:32 UTC
Read the original article
Hit count: 236
nginx
So I'm setting up a virtual path when pointing at a node.js app in my nginx conf. the relevant section looks like so:
location /app {
rewrite /app/(.*) /$1 break;
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Works great, except that when my node.js app (an express app) calls a redirect.
As an example, the dev box is running nginx on port 8080, and so the url's to the root of the node app looks like:
When I call a redirect to '/app' from node, the actual redirect goes to:
© Server Fault or respective owner