Until the last few days we had the following architecture: HAProxy -> 2 Backend servers

Now we have: HAProxy -> Varnish -> 2 Backend servers

Before, HAProxy was setting the "X-FORWARDED-FOR" header correctly every time. Now however, it only sets the header sometimes.

By sometimes I mean: I make a request to a PHP script that prints the contents of $_SERVER (holds the header in discussion).

No matter how many times I make the request, HAProxy won't set the header. IF however, I make a request to my script, and then quickly (before the request ends) I hit refresh (so basically I'm making 2 simultaneous requests), the header is being set.

Did someone stumble upon this very weird issue and can point me in the right direction?

Note: putting varnish in front of HAProxy is not an option.

  • What's the HAProxy configuration look like? Jul 21 '12 at 0:19

Most likely you forgot to use "option http-server-close" in your haproxy configuration. It was OK earlier because your backend servers did not enable keep-alive by default.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.