I was trying to use Thin app server and had one issue.
When nginx proxies the request to Thin (or Unicorn) using proxy_pass http://my_app_upstream;
the application receives the modified URL sent by nginx (http://my_app_upstream
).
What I want is to pass the original URL and the original request from client with no modification as the app relies heavily on it.
The nginx' doc says:
If it is necessary to transmit URI in the unprocessed form then directive proxy_pass should be used without URI part.
But I don't understand how exactly to configure that as the related sample is actually using URI:
location /some/path/ {
proxy_pass http://127.0.0.1;
}
So could you please help me figuring out how to preserve the original request URL from the client?
I found this above in the comments but I think it really should be an answer.
To perfectly forward without chopping the
absoluteURI
of the request and theHost
in the header:Found here: https://opensysnotes.wordpress.com/2016/11/17/nginx-proxy_pass-with-absolute-url/
I think the
proxy_set_header
directive could help:for my auth server... this works. i like to have options for /auth for my own humanized readability... or also i have it configured by port/upstream for machine to machine.
.
at the beginning of conf
Inside my 443 server block
At the bottom of conf
nginx also provides the $http_host variable which will pass the port for you. its a concatenation of host and port.
So u just need to do:
Just proxy_set_header Host $host miss port for my case. Solved by:
and then in the proxy.conf