Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
haproxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
haproxy
Commits
90fc5769
Commit
90fc5769
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Sanitize some if statements in jinja2
parent
d1547927
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/haproxy_cfg.jinja2
+14
-0
14 additions, 0 deletions
templates/haproxy_cfg.jinja2
with
14 additions
and
0 deletions
templates/haproxy_cfg.jinja2
+
14
−
0
View file @
90fc5769
...
@@ -106,6 +106,7 @@ frontend http_in
...
@@ -106,6 +106,7 @@ frontend http_in
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
{% if hostvars[host].routing is defined %}
{% if hostvars[host].routing is defined %}
http-request set-header x-routing-host {{ host }} if !letsencrypt_challenge { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ hostvars[host].routing.domain }} } { path -i -n -f /etc/haproxy/{{ host }}.path.list }
http-request set-header x-routing-host {{ host }} if !letsencrypt_challenge { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ hostvars[host].routing.domain }} } { path -i -n -f /etc/haproxy/{{ host }}.path.list }
...
@@ -118,6 +119,7 @@ frontend http_in
...
@@ -118,6 +119,7 @@ frontend http_in
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if routing is defined and routing.default is defined %}
{% if routing is defined and routing.default is defined %}
http-request set-header x-routing-host {{ routing.default }} if !letsencrypt_challenge { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ routing.domain }} }
http-request set-header x-routing-host {{ routing.default }} if !letsencrypt_challenge { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ routing.domain }} }
{% endif %}
{% endif %}
...
@@ -126,10 +128,12 @@ frontend http_in
...
@@ -126,10 +128,12 @@ frontend http_in
acl kibana_present hdr(host) -i -n '{{ kibana_domain|default(inventory_hostname) }}'
acl kibana_present hdr(host) -i -n '{{ kibana_domain|default(inventory_hostname) }}'
use_backend backend_redirect_ssl if kibana_present
use_backend backend_redirect_ssl if kibana_present
{% endif %}
{% endif %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
acl redirect_ssl_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.ssl.list
acl redirect_ssl_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.ssl.list
use_backend backend_redirect_ssl if redirect_ssl_{{host}}
use_backend backend_redirect_ssl if redirect_ssl_{{host}}
{% endfor %}
{% endfor %}
{% endif %}
acl domain_uses_bigpipe hdr(host) -i -n -f /etc/haproxy/use_bigpipe.list
acl domain_uses_bigpipe hdr(host) -i -n -f /etc/haproxy/use_bigpipe.list
{% if varnish_host|default(false) %}
{% if varnish_host|default(false) %}
acl is_purge method PURGE
acl is_purge method PURGE
...
@@ -141,6 +145,7 @@ frontend http_in
...
@@ -141,6 +145,7 @@ frontend http_in
acl static_content path_end .jpg .jpeg .gif .png .ico .swf .css .js .htm .html
acl static_content path_end .jpg .jpeg .gif .png .ico .swf .css .js .htm .html
use_backend backend_varnish if static_content !domain_ignores_varnish
use_backend backend_varnish if static_content !domain_ignores_varnish
{% endif %}
{% endif %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
use_backend backend_{{ host }}_bigpipe if domain_uses_bigpipe { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }}_bigpipe if domain_uses_bigpipe { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }} if { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }} if { hdr(x-routing-host) {{ host }} }
...
@@ -158,6 +163,7 @@ frontend http_in
...
@@ -158,6 +163,7 @@ frontend http_in
use_backend backend_{{host}} if crm_domain_in_{{host}}
use_backend backend_{{host}} if crm_domain_in_{{host}}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% for cert in proxy_certificates %}
{% for cert in proxy_certificates %}
{% if cert.active|default(true) %}
{% if cert.active|default(true) %}
...
@@ -216,6 +222,7 @@ frontend https_in_{{ cert.ip }}
...
@@ -216,6 +222,7 @@ frontend https_in_{{ cert.ip }}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
{% if hostvars[host].routing is defined %}
{% if hostvars[host].routing is defined %}
http-request set-header x-routing-host {{ host }} if { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ hostvars[host].routing.domain }} } { path -i -n -f /etc/haproxy/{{ host }}.path.list }
http-request set-header x-routing-host {{ host }} if { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ hostvars[host].routing.domain }} } { path -i -n -f /etc/haproxy/{{ host }}.path.list }
...
@@ -228,6 +235,7 @@ frontend https_in_{{ cert.ip }}
...
@@ -228,6 +235,7 @@ frontend https_in_{{ cert.ip }}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if routing is defined and routing.default is defined %}
{% if routing is defined and routing.default is defined %}
http-request set-header x-routing-host {{ routing.default }} if { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ routing.domain }} }
http-request set-header x-routing-host {{ routing.default }} if { hdr(x-routing-host) undefined } { hdr(host) -i -n {{ routing.domain }} }
{% endif %}
{% endif %}
...
@@ -239,10 +247,12 @@ frontend https_in_{{ cert.ip }}
...
@@ -239,10 +247,12 @@ frontend https_in_{{ cert.ip }}
acl is_{{ external.key }} {{ external.acl }}
acl is_{{ external.key }} {{ external.acl }}
use_backend backend_{{ external.key }} if is_{{ external.key }}
use_backend backend_{{ external.key }} if is_{{ external.key }}
{% endfor %}
{% endfor %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
acl crm_redirect_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.list
acl crm_redirect_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.list
use_backend backend_redirect if crm_redirect_{{host}}
use_backend backend_redirect if crm_redirect_{{host}}
{% endfor %}
{% endfor %}
{% endif %}
acl domain_uses_bigpipe hdr(host) -i -n -f /etc/haproxy/use_bigpipe.list
acl domain_uses_bigpipe hdr(host) -i -n -f /etc/haproxy/use_bigpipe.list
{% if varnish_host|default(false) %}
{% if varnish_host|default(false) %}
acl domain_ignores_varnish hdr(host) -i -n -f /etc/haproxy/ignore_varnish.list
acl domain_ignores_varnish hdr(host) -i -n -f /etc/haproxy/ignore_varnish.list
...
@@ -250,6 +260,7 @@ frontend https_in_{{ cert.ip }}
...
@@ -250,6 +260,7 @@ frontend https_in_{{ cert.ip }}
acl static_content path_end .jpg .jpeg .gif .png .ico .swf .css .js .htm .html
acl static_content path_end .jpg .jpeg .gif .png .ico .swf .css .js .htm .html
use_backend backend_varnish if static_content !domain_ignores_varnish
use_backend backend_varnish if static_content !domain_ignores_varnish
{% endif %}
{% endif %}
{% if 'webserver' in groups %}
{% for host in groups['webserver']|sort %}
{% for host in groups['webserver']|sort %}
use_backend backend_{{ host }}_https_bigpipe if domain_uses_bigpipe { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }}_https_bigpipe if domain_uses_bigpipe { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }}_https if { hdr(x-routing-host) {{ host }} }
use_backend backend_{{ host }}_https if { hdr(x-routing-host) {{ host }} }
...
@@ -267,6 +278,7 @@ frontend https_in_{{ cert.ip }}
...
@@ -267,6 +278,7 @@ frontend https_in_{{ cert.ip }}
{% if hostvars[host].proxy_crm_domains is defined %}
{% if hostvars[host].proxy_crm_domains is defined %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% for external in cert.external|default([]) %}
{% for external in cert.external|default([]) %}
backend backend_{{ external.key }}
backend backend_{{ external.key }}
...
@@ -277,6 +289,7 @@ backend backend_{{ external.key }}
...
@@ -277,6 +289,7 @@ backend backend_{{ external.key }}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% if 'webserver' in groups %}
{% if proxy_default_backend not in groups['webserver'] %}
{% if proxy_default_backend not in groups['webserver'] %}
backend backend_{{ proxy_default_backend }}
backend backend_{{ proxy_default_backend }}
...
@@ -328,6 +341,7 @@ backend backend_{{host}}_https_bigpipe
...
@@ -328,6 +341,7 @@ backend backend_{{host}}_https_bigpipe
server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 check maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}}
server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 check maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if varnish_host|default(false) %}
{% if varnish_host|default(false) %}
backend backend_varnish
backend backend_varnish
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment