I am a newb to HAProxy, and am bashing my head against this one. Iām trying to set up what I think is a fairly simple exercise in mapping applications listening on various ports to specific URLs.Like if my app page-designer is listening at http://IP:30000,then i would like to map it to http://IP/page-designer.I know i have asked a similar question before.But this time, the question is actually a little different.Upon doing some research,I heard that this can be done using http-request redirect or by adding reqrep ^([^\ ])\ /page-designer(.) \1\ \2 in the backend.
haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend http-in
mode http
bind 206.189.22.155:80
acl path-page-designer path_beg -i /page-designer
use_backend page-designer-backend if path-page-designer
backend page-designer-backend
mode http
option httplog
option forwardfor
server appserver1 206.189.22.155:30000
hitting http://206.189.22.155:30000 shows me the apache tomcat homepage.But hitting http://206.189.22.155/page-designer shows me "HTTP Status 404 - /page-designer the requested resource is not available".So how should i modify my haproxy.cfg to use http-request redirect or http-request set-path to rewrite the requested path.I have also tried this with another node js app running on port 5000,but that time instead of 404 error i was getting "Cannot GET /page-designer".So i am sure what is actually going wrong here.Plz help?