load balancing - haproxy redirect based on response status code -


i'm trying haproxy redirect new location if receives 404 response backend server. if not receive 404, respond normally.

this made sense me, doesn't seem work:

frontend  front     option httplog     bind *:8080     default_backend             app  backend app     balance     roundrobin     acl document_request path_beg -i /documents     acl not_there status 404     http-request redirect location http://newlocation/%[path] if document_request not_there     server  webserver1 10.10.10.10:8080 check 

i received following warning:

acl 'not_there' never match because involves keywords incompatible 'backend http-request header rule'

i'm using version 1.5.14 on centos 7.

any ideas on how make work? possible trying do?

any assistance appreciated.

thanks,

al

http-request redirect redirects request (optionally) based on condition inspects request.

status can inspect response. 'incompatible http-request header rule' means status compatible http-response rules.

at time got status code can rewrite response. try editing location , status http-response set-header resp. set-status.

since version 1.6 can use http-response redirect.


Comments