Character escaping in proxy pass question

Is there a way to use “proxy_pass” without having it unescape the
characters
in the uri?

For example, using the following configuration:

    location /my_proxy/ {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;

        proxy_pass http://my_proxy/;
    }

A request to “/my_proxy/sites/http%3A%2F%2Fwww%2eexample%2ecom” will
arrive
to the my_proxy server as “/sites/http://www.example.com”, instead of
“sites/http%3A%2F%2Fwww%2eexample%2ecom”.

You can get the raw format by removing the slash at the end of the
proxy_pass:

    location /my_proxy/ {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;

        proxy_pass http://my_proxy;
    }

Now, a request to “/my_proxy/sites/http%3A%2F%2Fwww%2eexample%2ecom”
will
arrive to the my_proxy server as
“my_proxy/sites/http%3A%2F%2Fwww%2eexample%2ecom”, instead of
“sites/http%3A%2F%2Fwww%2eexample%2ecom”.
I would like “my_proxy” would to gone but the rest of the uri to remain
escaped.

I’ve tried manually rewriting like so:

    location /my_proxy/ {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;

        rewrite      /my_proxy/(.*)  /$1  break;
        proxy_pass http://my_proxy;
    }

However, this results in the same behavior as the first example (where
the
unescaping still occurs.)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs