Disable automatic urlencoding with proxy_pass

Matthieu Tourne matthieu.tourne at gmail.com
Thu May 9 23:02:43 UTC 2013


On Thu, May 9, 2013 at 2:37 AM, lupin <nginx-forum at nginx.us> wrote:

> Hi,
>
>  Any way to disable urlencode on nginx with proxy_pass? Following is my
> config and as suggested on google I already removed the "/" URI part of
> of this "proxy_pass  http://127.0.0.1:8090;"
>
>  Any idea how to proceed with this?
>
>
I think I might have ran into something similar before.

Internally Nginx has 2 ways to deal with this directive :

    proxy_pass  http://127.0.0.1:8090;

Either you've never touched the internal uri (no internal redirects for
instance) and your outgoing uri is going to be exactly the same as the
incoming uri. Internally r->valid_unparsed_uri is set to 1.

Or your internal has been modified, and the outgoing uri used by proxy_pass
will be re-normalized.
The re-normalization process might turn up differences between incoming and
outgoing uri.

Another way to force Nginx to send out exactly what you want is to do
something like this :

    map '' $seed_uri {
        default $request_uri;
    }

    proxy_pass  http://127.0.0.1:8090$seed_uri;

This way you're forcing what comes in to be exactly what comes out, but
this comes with a price and you won't be able to use internal redirection
and will have to modify the content of $seed_uri manually, using if and
regexps for instance.

Hope that helps,

Matthieu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130509/9e9ccb4d/attachment.html>


More information about the nginx mailing list