HAProxy community

How to use capture.req.uri?


#1

Hi

I would like to add some header to response if the path begins with something,

here is my config:

global
  debug
frontend www
  bind *:8000
  mode http
  http-response set-header TEST1 YES1 if { capture.req.uri -m beg /test/ }
  default_backend be

backend be
  mode http
  acl is_test capture.req.uri -m beg /test/
  http-response set-header TEST2 YES2 if is_test
  server s1 127.0.0.1:8080

But it does not work. Please help

I’m using v1.9.2.

Thanks


#2

I think it has to look like this:

%[capture.req.uri]