HAProxy community

Problem with adding trailing slash conditionally

Hi @ all,

I’ve got a problem with a conditional redirect with HA-Proxy version 2.0.17.

I want to workaround a courtesy redirect made by IIS in the following case: The request goes to https://sub.domain.tld/DocuWare which is then redirected to http://sub.domain.tld/DocuWare/ by the IIS as we’re using SSL offloading on the haproxy server. So the automatic login fails as some of the cookies have the secure flag.

So I tried to build a conditional redirect on the frontend that already adds the trailing slash on the load balancer and the first request to the IIS will already be with the correct path /DocuWare/.

So I made the following addition to the frontend:

acl missing_slash path_reg ^\/((D|d)ocu(W|w)are)$
acl docuware_test hdr(host) -i sub.domain.tld sub
http-request redirect code 301 prefix / drop-query append-slash if missing_slash docuware_test

I wrote the redirect according to the following examples: https://www.haproxy.com/de/documentation/aloha/9-5/traffic-management/lb-layer7/http-redirection/#examples-of-traffic-redirection

The problem now is, that my redirect also adds a trailing slash to some other requests which then result in a 404 :confused:

Am I doing something wrong or does the regex not work as intended?

Any help would be highly appreciated as we’re facing massive logon problems with the application at the moment. (I’m not blaming haproxy for this)

Best regards


Seems like we had some problems with the browser cache… When deleting everything concerning that webpage, the redirect just worked fine.