Score:0

Apache module proxy_html not working

lc flag

I have a Joomla 4 site running in a Ubuntu 22.04 server (hostname = web-02). The Internet facing web server running in a Ubuntu 20.04 server (hostname = web-01) has configured as a reverse proxy for several applications. Both servers run Apache2.4. In web-01, the VirtualHost's config is like this:

<VirtualHost *:443>
...
ProxyPass       /site2 http://web-02/site2
ProxyPassReverse    /site2 http://web-02/site2
...

From outside, when I call up https://{real-domain-name}/site2/, most contents appear OK except the site's logo. Upon inspecting the HTML I noticed that this is due to a wrong URL:

   <img loading="eager" decoding="async" src="http://web-02/site2/images/headers/logo.gif" alt="xxxxxx" width="760" height="117">

On the web-01 I have enabled, among others, the following Apache2 modules

proxy, proxy_connect, proxy_html, proxy_http, rewrite

If I go inside web-01 and do wget http://web-02/site2/ The resulting html file shows the wrong URL: http://web-02/site2/images/headers/logo.gif

If I go inside web-02 and do wget http://localhost/site2/ The resulting html file shows the wrong URL: http://localhost/site2/images/headers/logo.gif

So Joomla got the full URL from the $_SERVER variables and this is something I cannot change.

But in the end, how on earth did http://web-02/site2/... appear in the first place? Isn't that what mod_proxy_html is for?

Score:1
lc flag

I figured out with reference to Using ProxyHTMLURLMap to redirect css and js requests The new configuration is like this:

<Location /site2>
    ProxyPass       http://web-02/site2
    ProxyPassReverse    http://web-02/site2
    ProxyHTMLEnable     On
    RequestHeader unset Accept-Encoding
    ProxyHTMLURLMap     http://web-02/site2 /site2
</Location>

Unset Accept-Encoding is needed, thanks to https://stackoverflow.com/questions/40683850/apache-proxying-leads-to-err-content-decoding-failed-error

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.