Nginx as a proxy, needs to follow 301 responses

hendrik nginx-forum at
Thu Aug 19 01:31:23 MSD 2010

Hi everyone,

I am using nginx as a proxy for custom URLs. I call URLs like
/proxy/ and nginx acts as a proxy for This works fine as long as the response
from the upstream server is not a 301. If it is a 301, this gets
forwarded to the client which then calls the target location directly.

Is there a way nginx can resolve these 301s and deliver the contents to
the client? You can find the config below.

Thank you very much!

location ~* ^/proxy/(.*?)/(.*)$ {
    resolver          ;
    proxy_pass                  http://$1/$2;
    server_name_in_redirect     on;

Posted at Nginx Forum:,121104,121104#msg-121104

More information about the nginx mailing list