Suppose I have two servers and I have set up DNS round robin as following:
www IN A 192.168.0.2
www IN A 192.168.0.3
From this FAQ, it states that “all of the latest browsers (IE, Firefox, Safari, and Chrome) support a client retry (sometimes called browser retry). So when it times out because a server is down, it will retry and hit the next server in the round robin”.
My question is: If I want to let the web server in 192.168.0.2 stay running, what should it return (HTTP status code? connection refuse?) so that some request (e.g. host header = cde.com) are redirected to 192.168.0.3?
UPDATE:
Or should I just close the tcp socket if the host header does not match?
I think the retry you are referring to is occurring at the TCP/IP level – if you return an HTTP response, you are pretty much saying “Hi there! I’m a webserver! I’m alive!”
What you could try then is blocking all port 80 traffic using iptables on the .2 server, perhaps with some extra rules to let you continue testing?
Edit: since that won’t fly, I’d suggest putting something at the HTTP level in front of the webservers, such as haproxy, to let you balance and manage the incoming requests.