nginx rewrite url without causing redirect and proxy to backend app

nanaya me at myconan.net
Wed Nov 4 03:43:46 UTC 2015



On Wed, Nov 4, 2015, at 05:27 AM, kodeninja wrote:
> Howdy, everyone!
> 
> I'm trying to figure out if there's a way to achieve this with nginx:
> <http://stackoverflow.com/questions/33427101/nginx-rewrite-url-without-causing-redirect-and-proxy-to-backend-app>.
> I didn't get response on the SO question yet, so trying my luck here :).
> 
> Please let me know if this is possible.


 A request URI is passed to the server as follows:

    If the proxy_pass directive is specified with a URI, then when a
    request is passed to the server, the part of a normalized request
    URI matching the location is replaced by a URI specified in the
    directive: 

location /name/ {
    proxy_pass http://127.0.0.1/remote/;
}


http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

Also in case of rewrite you probably want `break` since `last` restart
location matching process



More information about the nginx mailing list