Haproxy redirect to subdomain
-
Hello, for now I have configuration with two backend and shared-https-frontend
# Automaticaly generated, dont edit manually. # Generated on: 2019-10-14 17:49 global maxconn 1000 log /var/run/log local0 debug stats socket /tmp/haproxy.socket level admin gid 80 nbproc 1 hard-stop-after 15m chroot /tmp/haproxy_chroot daemon tune.ssl.default-dh-param 2048 server-state-file /tmp/haproxy_server_state listen HAProxyLocalStats bind 127.0.0.1:2200 name localstats mode http stats enable stats admin if TRUE stats show-legends stats uri /haproxy/haproxy_stats.php?haproxystats=1 timeout client 5000 timeout connect 5000 timeout server 5000 frontend shared-https-merged bind xx.xx.xx.xx:443 name xx.xx.xx.xx:443 ssl crt-list /var/etc/haproxy/shared-https.crt_list mode http log global option log-separate-errors option httplog option http-keep-alive option forwardfor acl https ssl_fc http-request set-header X-Forwarded-Proto http if !https http-request set-header X-Forwarded-Proto https if https timeout client 30000 rspirep ^(set-cookie:.*) \1;\ Secure acl aclcrt_shared-https var(txn.txnhost) -m reg -i ^([^\.]*)\site\.com(:([0-9]){1,5})?$ acl aclcrt_shared-https var(txn.txnhost) -m reg -i ^site\.com(:([0-9]){1,5})?$ acl ACL1 var(txn.txnhost) -m str -i wiki.site.com acl ACL2 var(txn.txnhost) -m str -i jira.site.com http-request set-var(txn.txnhost) hdr(host) use_backend wiki.site.com_ipv4 if ACL1 use_backend jira.site.com if ACL2 frontend http-to-https bind xx.xx.xx.xx:80 name xx.xx.xx.xx:80 mode http log global option http-keep-alive timeout client 30000 http-request redirect scheme https backend wiki.site.com_ipv4 mode http id 10100 log global timeout connect 30000 timeout server 30000 retries 3 source ipv4@ usesrc clientip option httpchk OPTIONS / server wiki 10.140.100.120:8090 id 10101 check inter 1000 backend jira.site.com_ipv4 mode http id 10102 log global timeout connect 30000 timeout server 30000 retries 3 source ipv4@ usesrc clientip option httpchk OPTIONS / server jira 10.140.100.130:8080 id 10101 check inter 1000
So I need that url help.site.com will be redirected to jira.site.com/subfolder/subfolder1
How Can I do it?
-
Hello. I've resolved my issue
Just added http-request redirect to help.site.com frontend
acl ACL3 var(txn.txnhost) -m str -i help.site.com
http-request redirect code 301 location https://jira.site.com/subfolder/subfolder1 if ACL3 -
@blasta
Just want to say thank you!
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.