1
votes

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?

2

2 Answers

4
votes

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.

0
votes

In the case of Mozilla, the retry basically means: if there is a connection establishment failure (like host unreachable, connection establishment timeout, or connection refused) to the first IP address, the second IP address will be used.

I could probably find the lxr link to the code, if someone really wanted to know.

(For Proxy Auto Config files, there is a more complicated behavior as well).

So, in these cases, they would be situation where your web server does not actually compose a response that the browser receives. So, no coding required.