Score:0

Apache2 Reverse Proxy messes up CSS

vn flag

I have a problem that when I use an SSL reverse proxy from site1 to site2, it works quite well except for the peculiar fact that all images are of the incorrect height. Everything else seems to be in order, only image height is affected.

Here's how my ReverseProxy is set up:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName site2.com
    ServerAlias www.site2.com

    SSLProxyEngine On
    ProxyRequests Off

    ServerAdmin [email protected]
    ProxyPass "/"  "https://site1.com/"
    ProxyPassReverse "/"  "https://site1.com/"

    ServerAdmin [email protected]
    DocumentRoot /var/www/site2.com

    ProxyHTMLEnable On
    ProxyHTMLURLMap https://site1.com/ /

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/DOMAIN/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/DOMAIN/privkey.pem
</VirtualHost>
</IfModule>

Please help me out, I'm at a loss here and have no idea what could be causing this. This is running Apache2 on an otherwise stock Debian 10 system.

The CMS I'm using is wordpress.

EDIT: It seems like the source code on Site2 is messed up and therefore not identical to Site1. What can be done to make sure the proxied version is completely identical to Site1?

Steffen Ullrich avatar
se flag
The apache configuration likely isn't helpful. Look at the browsers developer console and see if it fails to load any resources. Maybe there are some absolute links which now fail to load, maybe HTTP links which fail because of mixed content when accessed from inside HTTPS. Such problems need to be fixed in the site content and not in the server configuration.
vn flag
Thanks for the suggestion, Steffen. But Site1 and Site2 shows the same console errors, although Site1 is working fine and Site2 is not. Also, Site2 requests resources directly from Site1 (Even though I have Site2 in the address bar, it requests css and other files directly from Site1).
vidarlo avatar
ar flag
@RottenBoot There's not enough information here to diagnose this issue. Either you have to provide us access to the sites in question or include all relevant differences.
vidarlo avatar
ar flag
Your issue here is that you try to make wordpress behave under two different URL's. Wordpress is not built for that. It's not an apache problem or a proxy problem; it's a wordpress problem. The **proper** solution is probably a 301 redirect. Duplicate content will lead to a hit in seo ranking as well.
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.