Proxypass/PoxyPassReverse in HAproxy howto

Hi,

I’m moving proxy setups from apache to HAProxy.
All “normal” proxy and loadbalancing setups works already. We even managed to proxy/loadbalance our Sharepoint-servers.

I have in apache these 2 rules and I want to convert them to HAproxy, but somehow I can’t get it work.

ProxyPass / http://192.168.10.10:80/path1/path2/path3
ProxyPassReverse / http://192.168.10.10.:80/path1/path2/path3

Any ideas how to do this?

Thanks in advance.

Can you tell us what those 2 Apache directives do so we don’t have to dig into Apache documentation?

The user comes with an url like: http://first.example.com then he or she will be always redirected to: http://192.168.10.10:80/path1/path2/path3 on the server 192.168.10.10.
It’s not possible on that server to make any adjustments, because of the fact that it is maintained by other people then we.
Hope it makes a bit clear.

Redirected (so the clients will see /path1/path2/path3 in the URI in the browsers) or Rewrite (so the client will not see /path1/path2/path3)?

Rewrite will be the thing with not visible paths.

Use reqrep:
http://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-reqrep

Solved with a reqirep

frontend http
acl info hdr(host) -i info.domain.com
use_backend Info if info

backend Info
mode http
option forwardfor
reqirep ^([^\ :])\ /(.) \1\ /path1/path2/path3\2
http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload;
server WS001 hostname.domain.local:80 cookie S2 check