Published a month ago
Published a month ago
Chris Couture
Updated a month ago
2
I was able to solve this after some searching and figured I'd share what my issue was. Let me say, I'm a jack of all trades and a master of none so this may be "well duh" information to some of you guys. Here was my issues.
In my virtual hosts setup, which worked perfectly with Apache serving direct to the internet (via firewall and port forwarding), I had the following setting:
<VirtualHost 10.10.30.19:80 > (hard coded IP of server)
This served multiple websites fine and apache would select the correct site to display based on the ServerName setting... but once the DNS was changed and the site was behind the reverse proxy of SafeLine WAF, it would serve the first site in the config ony.
Changing one thing on all of the virtual hosts fixed the issue... Remove the IP and use *.
<VirtualHost *:80 > #change this for all virtual hosts in config...
Once saved and httpd reloaded, this worked perfectly (with a different setup for the site obviously.
Here is a look at one of my sites for reference:
<VirtualHost *:80>
SetEnvIf X-Forwarded-Proto https HTTPS=on
ServerName mywebsitedomain.com
ServerAlias www.mywebsitedomain.com
DocumentRoot /var/www/mywebfiles
<Directory /var/www/mywebfiles>
Require all granted
AllowOverride All
Options FollowSymLinks
</Directory>
ErrorLog logs/mywebsite-error.log #optional
CustomLog logs/mywebsite-access.log combined #optional
NOTE: I also have this set at the top of my apache config. I run Apache on a different server with a different IP address so this is on that system, not the Safeline system.
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.10.30.2 #This is the IP of the Safeline Server, not the web server.
I hope this helps someone searching for the same topic. I'll throw some keywords below to help in the site search.
Chris C.
apache config
apache serves wrong site
apache not working correct
apache setup
multiple servers apache