Re: trying to get something like proxypassreverse going

Tim U. [email protected] wrote:

Hi there,

Arrange that the backend application generates the correct-for-you urls
directly. That way, nginx doesn’t have to do any special processing of
the body content, and it can just do what it does best.

Thanks Francis for that concise and extremely clear explanation of
what is going on. I now know where to go proceed.

You’re welcome.

There’s a fuller discussion of the issue – in the context of apache –
at Running a Reverse Proxy with Apache:

If you really really can’t adjust the backend application, then you’ll
want something like apache’s mod_proxy_html (or mod_substitute, or
mod_sed, but they will leave lots of the fiddly details up to you to
get right).

nginx_substitutions_filter at http://wiki.nginx.org/NginxHttpSubsModule
looks like the closest starting point to me; but you pretty much have to
parse the html and css to find things that end browser will consider a
url, and change all of them and only them. Parsing with regexes isn’t
fun.

Possibly someone has already done the work of creating an nginx version
of mod_proxy_html and then put it somewhere hidden from $SEARCH_ENGINE;
more likely everyone just configures the backend application to avoid
the need to adjust.

All the best,

f

Francis D. [email protected]