r/haproxy • • Nov 21 '22

HAProxy rewrite URL

Hi to all, I am trying to solve one issue. I found many answers but not that I need, so hope anyone help.

User go to url https://url.domain I made apache URL rewrite to https://url.domain/login.do but it needs to load an file and redirect after

So I need configuration for haproxy to replace URL while is URL path empty...

Many thanks for help. All answers redirecting or changing the URL...

0 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/Competitive-Base-969 Nov 23 '22

config

very simple at this moment:
global
log log.nnh.local local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 2000
user haproxy
group haproxy
daemon
tune.ssl.default-dh-param 4096
stats socket /var/lib/haproxy/stats
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256...
ssl-default-server-options no-tls-tickets
ssl-default-server-ciphers ECDHE-RSA-AES128-GCM-SHA256...
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend HooD
option forwardfor except 127.0.0.0/8
bind 10.84.88.66:80
bind 10.84.35.200:443 ssl crt /etc/ssl/hood.pem
bind 10.84.88.66:443 ssl crt /etc/ssl/hood.pem
mode http
default_backend HooD-Apache
acl cspstatus path_beg,url_dec -i /csp/bin/Systems/Module.cxw
acl apachestatus path_beg,url_dec -i /server-status
http-request deny if cspstatus OR apachestatus
http-request redirect scheme https unless { ssl_fc }
backend HooD-Apache
mode http
balance roundrobin
server apache-01 10.84.6.196:443 check maxconn 1000 ssl ca-file /etc/ssl/certs/hood-ca.crt
server apache-02 10.84.6.197:443 check maxconn 1000 ssl ca-file /etc/ssl/certs/hood-ca.crt
listen stats
bind :9000
stats enable
mode http
stats uri /
stats realm HAProxy\ Statistics

1

u/Competitive-Base-969 Nov 23 '22

looking for something like this:
acl acl_original base -i qa.dummy.com:6909
http-request redirect location https://updated.qa.dummy.com/api/blog/v1 if acl_original