Question

Loadbalancers/Proxies tend to add an X-Forwarded-For header to requests. Is there an equivalent response header for this, identifying the server that handled the request?

Maybe X-Forwarded-To?

Was it helpful?

Solution

There is no "standard" header for that as it is a rather rare use-case to actually want to identify a backend server to the final client in a header.

In HAProxy, about the only way possible right now is to use the cookie setting in backend servers which can then return a cookie back to the client identifying the server. But that has the potentially unfortunate side-effect that the client returns the cookie back in subsequent requests which HAProxy then uses for sticky sessions.

Depending on your use-case, it might be enough to just check the HAProxy logs. For each request, it states there which backend and which server handled the request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top