Apache with multiple domains, single IP, VirtualHost is catching the wrong traffic
Posted
by
apuschak
on Server Fault
See other posts from Server Fault
or by apuschak
Published on 2012-12-05T18:47:05Z
Indexed on
2012/12/05
23:06 UTC
Read the original article
Hit count: 201
I have a SOAP web service I am providing on a apache web server. There are 6 different clients (IPs) that request data and 3 of them are hitting the wrong domain. I am trying to find a way to log which domain name the requests are coming from.
Details:
ServerA is the primary
ServerB is the backup
domain1.com - the domain the web service is on
domain2.com - a seperate domain that server seperate content on ServerB
ServerA is standalone for now with its own IP and DNS from domain1.com. This works for everyone.
ServerB is a backup for the web service, but it already hosts domain2.com.
I added entries into the apache configuration file like:
<VirtualHost *:443>
ServerName domain2.com
DocumentRoot /var/www/html/
CustomLog logs/access_log_domain2443 common
ErrorLog logs/ssl_error_log_domain2443
LogLevel debug
SSLEngine on
... etc SSL directives ...
</VirtualHost>
I have these for both 80 and 443 for domain1 and domain2 with domain1 being second.
The problem is when we switch DNS for domain1 from ServerA to ServerB, 3 out of the 6 clients show up in the debug logs as hitting domain2.com instead of domain1.com and fail their web service request because domain2.com is first in the apache configuration file and catching all requests that don't match other virtualhosts, namely domain1.com.
I don't know if they are hitting www.domain1.com, domain1.com (although I added entries for both) or using the external IP address or something else. Is there a way to see which URL they are hitting not just the page request or someother way to see why the first domain is catching traffic meant for the second listed domain?
In the meantime, I've put domain1.com higher in the apache configuration than domain2.com. Now it catches the requests for all clients and works, however I don't know what it is catching and would like to make domain2.com the first entry again with a correct entry for domain1.com, for however they are hitting it.
Thank you for your help! Andrew
© Server Fault or respective owner