Nginx does redirect, not proxy

You have to use the proxy_redirect to handle the redirection.

 Sets the text that should be changed in the “Location” and “Refresh” header fields of a 
 proxied server response. Suppose a proxied server returned the header field 
 “Location:https://myserver/uri/”. The directive
 will rewrite this string to “Location: http://nginx_server:8080/uri/”. 

Example:

 proxy_redirect https://myserver/ http://nginx_server:8080/;

Source: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

Leave a Comment