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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Eric Zillmann
haproxy
Commits
cc3e4ed8
Commit
cc3e4ed8
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Optimize redirects for aliases to also recognize the target protocol and introduce the HSTS header
parent
2456e5e2
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
+13
-5
13 additions, 5 deletions
templates/haproxy_cfg
with
13 additions
and
5 deletions
templates/haproxy_cfg
+
13
−
5
View file @
cc3e4ed8
...
...
@@ -56,13 +56,13 @@ frontend http_in
http-request deny if blockedip
{% for host in groups['all'] %}
{% for redirect in hostvars[host].proxy_redirect|default([]) %}
redirect prefix
http
://{{redirect.to}} if { hdr(host) -i -n {{redirect.from}} }
redirect prefix
{{ redirect.protocol|default('https') }}
://{{redirect.to}}
code 301
if { hdr(host) -i -n {{redirect.from}} }
{% endfor %}
{% if proxy_redirect_aliase %}
{% for drupal in hostvars[host].drupal_settings|default([]) %}
{% for domain in drupal.domains|default([]) %}
{% for alias in domain.aliases|default([]) %}
redirect prefix
http
://{{domain.domain}} if { hdr(host) -i -n {{alias}} }
redirect prefix
{{ domain.protocol|default('https') }}
://{{domain.domain}}
code 301
if { hdr(host) -i -n {{alias}} }
{% endfor %}
{% endfor %}
{% endfor %}
...
...
@@ -94,13 +94,13 @@ frontend https_in_{{ cert.ip }}
http-request deny if blockedip
{% for host in groups['all'] %}
{% for redirect in hostvars[host].proxy_redirect|default([]) %}
redirect prefix
http
://{{redirect.to}} if { hdr(host) -i -n {{redirect.from}} }
redirect prefix
{{ redirect.protocol|default('https') }}
://{{redirect.to}}
code 301
if { hdr(host) -i -n {{redirect.from}} }
{% endfor %}
{% if proxy_redirect_aliase %}
{% for drupal in hostvars[host].drupal_settings|default([]) %}
{% for domain in drupal.domains|default([]) %}
{% for alias in domain.aliases|default([]) %}
redirect prefix
https
://{{domain.domain}} if { hdr(host) -i -n {{alias}} }
redirect prefix
{{ domain.protocol|default('https') }}
://{{domain.domain}}
code 301
if { hdr(host) -i -n {{alias}} }
{% endfor %}
{% endfor %}
{% endfor %}
...
...
@@ -116,7 +116,7 @@ frontend https_in_{{ cert.ip }}
{% endif %}
{% for host in groups['all'] %}
acl ssl_domain_in_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.ssl.list
use_backend backend_{{host}} if ssl_domain_in_{{host}}
use_backend backend_{{host}}
_https
if ssl_domain_in_{{host}}
acl redirect_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.list
use_backend backend_redirect if redirect_{{host}}
{% if hostvars[host].proxy_crm_domains is defined %}
...
...
@@ -133,6 +133,14 @@ backend backend_{{host}}
{% else %}
server server_{{host}} {{hostvars[host]['static_ipv4']|default(hostvars[host]['ansible_default_ipv4']['address'])}}:80 maxconn 100
{% endif %}
backend backend_{{host}}_https
{% if host == inventory_hostname %}
http-response deny
{% else %}
http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
server server_{{host}} {{hostvars[host]['static_ipv4']|default(hostvars[host]['ansible_default_ipv4']['address'])}}:80 maxconn 100
{% endif %}
{% endfor %}
{% if varnish_host|default(false) %}
...
...
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