Broken Django behind a Load Balancer

Having problems with your seven Django servers behind a single load balancer or proxy, and you have no idea which of the servers is giving your that “one in eight requests” error?

The solution is simple, add some information about the instance to the HTTP response headers!

It doesn’t really matter which load balancing or proxy solution you use, Amazon ELB, HAProxy, Varnish, Pound, Nginx, this would just work with most of them without any modification.

Here is a simple example of just such a middleware:
https://gist.github.com/2393220#file_hostname_middleware.py

2 thoughts on “Broken Django behind a Load Balancer

Leave a Reply

Your email address will not be published. Required fields are marked *