I have a reverse proxy setup for access to a third party application located inside a intranet from the internet. Let's say this application is on the URL:
https://internalserver:8080/
(reachable only from the intranet)
and the proxy is on:
https://proxyserver/
(reachable from any place in the world)
The proxy is managed by nginx and is working ok. When the user accesses https://proxyserver/
they get the content of the app at https://internalserver:8080/
.
The problem is that the application is writing absolute URLs in the HTML response so, when the user clicks a link to a new page the browser is trying to locate the page with its internal name, e.g.
https://internalserver:8080/somepage
instead of
https://proxyserver/somepage
.
I know this is a program bug, but I'm not able to modify the program.
Can I intercept the response, modify the URLs and send it (modified) to the final client with nginx? Or maybe with another tool?
EDIT: I saw this question before, but my case is more specific, the quoted question ask for a generic modification. In that case the fast-cgi ad hoc program is the best solution, what I want is a more specific solution for (I think) a more common scenario. while a fast-cgi program can work I´m looking for a easiest and maybe stronger and proved into the real world, solution for this scenario.