We have Similar setup to this diagram
Where request arrives to HAProxy, it get's roundrobin balanced to any servers, backend server checks its cache and if resource is not on that server it issues redirect with header set to the correct server IP.
Second time request arrives to HAProxy, it detects that the header with backend server is there, but how can I take that IP and direct request directly to it?
For example, second time request arrives to haproxy it has header X-BACKEND-IP=10.0.0.5
So instead haproxy trying to load balance that request, I want it to read the header, take that IP and go directly to that backend.
Is that possible? If not, would it be possible with nginx ?
X-BACKEND-IP
with an available server to itself -> 4) detects that the requested resource is available -> 5) sends request to resource. Your goal is to eliminate step 3 and 4? – IronwoodX-BACKEND-IP
header and redirects back to haproxy (all fine up to this point) -> 4) HAProxy will take that header and route directly to the IP from the header – Drumhead