Threatmark Haproxy setup


My department received a request from a client to reconfigure haproxy so that it can work as a reverse proxy and communicate between a client request and treatmark servers.

The whole setup should be that when a client visits URL it goes to haproxy and then I guess it gets somehow forwarded to threatmark and then the response is returned to the client through haproxy if i got it correct.

But I am getting 404 error but when going directly to threatmark I get a response.

The excerpt from haproxy config is below. Links are scrambled due to security.

I am not very well familiar with the regex part of config.

Thanks for any help and suggestions.

backend tm11
#balance roundrobin
#http-check expect string
option forwardfor
email-alert mailers mta
email-alert from
default-server inter 15s
#cookie SERVERID insert indirect nocache
#cookie ASP.NET_SessionId insert indirect nocache
timeout connect 30s
timeout server 30s

acl p_tm1 path -i /online/bundles/23WEEnwsi6.js
http-request set-path "%[path,regsub(^/online/bundles/23WEEnwsi6.js,/app/retail/getjs,i)]" if p_tm1

acl p_tm2 path -i -m beg /online/bundles/ljhEEEzR
http-request set-path "%[path,regsub(^/online/bundles/ljhEEEzR,/app/retail/request,i)]" if p_tm2

server threatmark ssl sni req.hdr(Host) verify none

Managed to solve this by using set-URI instead of set-path. Basically rewriting the original URI into a new URI .
I am guessing that the server doesn’t have a website match for rewritten path URI which was and hence was returning error 404.