How to get WordPress to work behind Apache Reversed Proxy?
-
Spent a fair deal of time to get figure out the proper apache reversed proxy settings to get wordpress fully to work and so far it either ends up with that only main index pagee shows up correct and sub-pages won’t view correctly or doesn’t show at all. So trying to tap into the knowledge heere what the proper tweaks are to get WordPress to work when incoming traffic is coming via Apache proxy server.
This is the virtual host file from the Apache proxy server:
<VirtualHost *:80> ServerName www.example.com Redirect permanent "/" "https://www.example.com/" </VirtualHost> <VirtualHost *:443> ServerName www.example.com ProxyRequests Off ProxyPreserveHost On ProxyPass / https://192.168.202.52/ ProxyPassReverse / https://192.168.202.52/ RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "443" SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem </VirtualHost>
and added the following to code to wp-config.php to check if site is being served over HTTPS after the reverse proxy
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER['HTTPS'] = 'on'; }
What is it that I’m missing out on to get the WP site to work together with reverse proxy?
- The topic ‘How to get WordPress to work behind Apache Reversed Proxy?’ is closed to new replies.