Nginx reverse proxy making root webapp into custom path
The simple answer is no.
You need to consider at least three aspects of forcing an application to live away from the root.
- Mapping root based URLs to the new location - which is easy with
proxy_pass
or arewrite
- Mapping redirection responses (301, 302, etc) - which is easy with
proxy_redirect
- Mapping resource URLs and embedded hyperlinks
The last point is not easy. Applications which expect to live in the root, generally access their resources relative to the root, which means they hit the wrong location in the reverse proxy.
Apache has a module which can rewrite URLs embedded within the HTML document, but that seems rather inefficient to me.
The preferred solution is to change the application to make its resource and hyperlink URLs either path relative or prefixed with the same custom path.