proxy_redirect vs. relative URLs from upstream

m irya xmirya at gmail.com
Thu Jun 12 12:14:14 UTC 2014


Hi,

I'm trying to create a sinle proxying configuration as following:

location = /proxy {
        resolver 8.8.8.8;
        proxy_pass $args;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_redirect "" $uri?;
}

e.g. http://example.com/proxy?http://example2.com/ would deliver the
contents/headers of http://example2.com/ . If http://example2.com/ replies
with

Location: http://example3.com/

, the client gets

Location: http://example.com/proxy?http://example3.com/

, so it works as expected. However, i've got example2.com replying with
relative Location, e.g.:

Location: /some/path

This results in client getting:

Location: http://example.com/proxy?/some/path

, something that won't work. Is there any way to make it work for client to
get

Location: http://example.com/proxy?http://example2.com/some/path

?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140612/8e3a434e/attachment.html>


More information about the nginx mailing list