I am a newb to HAProxy, I have a website and several applications, the web page is https://audit.mydomain.com and the applications are api, gsdev
I want to get to this https://audit.mydomain.com/api and https://audit.mydomain.com/gsdev and add applications.
I have programmed in different ways but I can’t find the solution, I appreciate the help you can give me, this is my programming:
#---------------------------------------------------------------------
FrontEnd Configuration
#---------------------------------------------------------------------
frontend master
bind *:80
option forwardfor
reqadd X-Forwarded-Proto:\ http
redirect scheme https code 301 if !{ ssl_fc }
frontend master_https
bind *:443 ssl crt /etc/haproxy/ssl-myssl/myssl.pem
rspadd Strict-Transport-Security:\ max-age=31536000
option forwardfor
http-request deny if HTTP_1.0
http-request deny if { req.hdr(user-agent) -i -m sub curl phantomjs slimerjs }
http-request deny unless { req.hdr(user-agent) -m found }
reqadd X-Forward-Proto:\ https
acl host_web hdr(host) -i webtest.mydomain.com
use_backend webtest if host_web
acl gsdev_url hdr(host) -i gsdev.mydomain.com
use_backend gsapi if gsdev_url
acl audit_url hdr(host) -i audit.mydomain.com
use_backend audit if audit_url
acl url_api hdr(host) -i api.mydomain.com/api
use_backend api if url_api
#--------------------------------------------------------------
acl sub_api path_end -i /api
use_backend api if sub_api
#-----------------------------------------------------------------
default_backend webtest
#---------------------------------------------------------------------
BackEnd Configuration
#---------------------------------------------------------------------
backend webtest
balance roundrobin
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost
server slave1 10.10.2.45:8089 check
server slave2 10.10.2.56:8089 check
server slave1 10.10.2.45:443 backup check
backend gsapi
balance roundrobin
cookie gsapi_cook insert nocache
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost
server slave1 10.10.2.45:5000 check cookie slave1
server slave2 10.10.2.56:5000 check cookie slave2
server slave1 10.10.2.45:443 backup check
backend api
balance roundrobin
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost
reqrep ^([^\ :])\ /api:[/]?(.*) \1\ /\2
reqirep ^([^\ :])\ /app-2/(.) \1\ /app-2-another-path/\2
reqirep ^([^\ :])\ /api/(.) \1\ /api/\2
reqirep ^([^\ :]*)\ /api/ \1\ /api
server slave1 10.10.2.45:5005/api check
server slave2 10.10.2.56:5005/api check
server slave1 10.10.2.45:443 backup check
backend audit
balance source
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost
server slave2 10.10.2.56:5010 check
server slave1 10.10.2.45:443 backup check
1 post - 1 participant