Skip to content
Snippets Groups Projects
Commit 1e7c8af1 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-inventories/arocom#3120 Add support to route wildcard domains

parent fe279f08
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,14 @@ frontend http_in
http-request deny if { {{ rule }} }
{% endfor %}
http-request set-header x-routing-host undefined
{% for cert in proxy_certificates %}
{% if cert.active|default(true) %}
{% if cert.wildcard|default(false) and cert.wildcard_host is defined %}
http-request set-header x-routing-host {{ cert.wildcard_host }} if { hdr(host) -m end -i '.{{ cert.domain }}' }
use_backend backend_redirect_ssl if { hdr(host) -m end -i '.{{ cert.domain }}' }
{% endif %}
{% endif %}
{% endfor %}
acl letsencrypt_challenge path_beg /.well-known/acme-challenge/
http-request set-header x-routing-host maintenance if !letsencrypt_challenge { hdr(x-routing-host) undefined } { hdr(host) -i -n -f /etc/haproxy/maintenance.list }
http-request redirect code 301 location %[base,lower,map(/etc/haproxy/redirect.domain-and-path.map)] if !letsencrypt_challenge { base,lower,map(/etc/haproxy/redirect.domain-and-path.map) -m found }
......@@ -242,6 +250,9 @@ frontend https_in_{{ cert.ip }}
http-request deny if { {{ rule }} }
{% endfor %}
http-request set-header x-routing-host undefined
{% if cert.wildcard|default(false) and cert.wildcard_host is defined %}
http-request set-header x-routing-host {{ cert.wildcard_host }} if { hdr(x-routing-host) undefined } { hdr(host) -m end -i '.{{ cert.domain }}' }
{% endif %}
http-request set-header x-routing-host maintenance if { hdr(x-routing-host) undefined } { hdr(host) -i -n -f /etc/haproxy/maintenance.list }
{% for host in groups['all']|sort %}
{% for redirect in hostvars[host].proxy_redirect|default([]) %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment