How to rewrite URI nginx reverse proxy using proxy_pass?
Try adding the URL in your proxy location like this:
location = /app1/ { proxy_pass http://10.82.5:80/;}
Adding a trailing /
at the end of the proxy_pass forces nginx to strip the /app1
prefix from your requests while sending it to the backend.
Explanation on how it works on the official nginx page: http://nginx.org/en/docs/http/ngx_http_proxy_module.html?&_ga=1.74997266.187384914.1443061481#proxy_pass
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: