@pankaj.ghadge wrote:
I have 2 server witch run behind HaProxy Load balancer.
Here scenario is that application opens new popup window and it doesn’t carry forward parent cookies in pop up window, so it doesn’t know which back-end server will serve the request, so we have planned to pass it in URL like for initial request
Next request which comes after this will have the SERVERID as cookie, so here default haproxy backend will take care where to send the request
example. com/?balancer=app1 (This request should go to app1 server in backend)
OR
example. com/?balancer=app2 (This request should go to app2 server in backend)
I have 3 questions
Is it possible using below Haproxy configuration ?
How can I simplify this configuration ?
if argument is in middle like http://example.com/?id=10&balancer=app2&product_id=110 , then what will be the conditional check in Haproxy configuration?
frontend app-frontend
bind 127.0.0.1:9005
mode http
acl app1_url urlp_reg(balancer) ^app1$
acl app2_url urlp_reg(balancer) ^app2$
use_backend app1_backend if app1_url
use_backend app2_backend if app2_url
default_backend app-backendbackend app-backend
mode http
option httpclose
balance leastconn
cookie SERVERID insert indirect nocache
server app1 10.168.1.10:80 check cookie app1
server app2 10.168.1.20:80 check cookie app2backend app1_backend:
mode http
option httpclose
balance leastconn
cookie SERVERID insert indirect nocache
server app1 10.168.1.10:80 check cookie app1backend app2_backend:
mode http
option httpclose
balance leastconn
cookie SERVERID insert indirect nocache
server app2 10.168.1.20:80 check cookie app2
Posts: 1
Participants: 1