2

I have a loadbalancer that distributes traffic to 1 of 5 Web Nodes. Is there an easy way to tell what Web Node I am talking to when it serves me content. For example whould I implement a Header in Apache? Add a hidden HTML element on each page?

Bonus points: What do people do to force themselves to one specific web node?

go0n
  • 59
  • 1
  • 6

1 Answers1

1

There are various way to solve this issue. My favourite, mainly because it is easy, is to set an HTTP header specific to each server in the apache configuration that just contains the hostname. You can use an arbitrary string if you do not want to reveal the underlying hostnames.

# On host1
Header set ServerID host1
# On host2
Header set ServerID host2
# etc.

You can then see the relevant HTTP header in the request response.

With regards to forcing yourself to a particular node, that depends on the details of how you are load balancing the servers.

If you are running a stateless application and the load-balancer is just sending the requests in a round-robin, or some random manner, then there is little you can do to force yourself to a specific underlying node (other than maybe switching off all the other nodes).

However if your load-balancers are doing some form of cookie insertion (or similar) in order to provide sticky sessions, then you can normally tailor a request that will allow you to force yourself to a particular underlying node, but a lot depends on the method used.

Unbeliever
  • 2,336
  • 1
  • 10
  • 19
  • I was thinking the HTTP Header was the way to go. We do have a form of sticky sessions but I THINK its based on IP not a COOKIE. – go0n Nov 17 '16 at 20:02
  • If session stickyness is done purely on the load balancer then you probably wont be able to affect it directly, but talk to whoever maintains your load balancer. – Unbeliever Nov 18 '16 at 09:31