0

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?

1 Answer 1

1

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.