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
b83bb899
Commit
b83bb899
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
ansible-inventories/arocom#74 Enhance redirects
parent
e8bd4813
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
defaults/main.yml
+1
-0
1 addition, 0 deletions
defaults/main.yml
tasks/configure.yml
+1
-0
1 addition, 0 deletions
tasks/configure.yml
templates/haproxy_cfg
+36
-18
36 additions, 18 deletions
templates/haproxy_cfg
with
38 additions
and
18 deletions
defaults/main.yml
+
1
−
0
View file @
b83bb899
...
...
@@ -5,3 +5,4 @@ proxy_blacklist_ips: []
proxy_timeout_connect
:
'
5s'
proxy_timeout_client
:
'
20s'
proxy_timeout_server
:
'
45s'
proxy_redirect_aliase
:
false
This diff is collapsed.
Click to expand it.
tasks/configure.yml
+
1
−
0
View file @
b83bb899
...
...
@@ -45,6 +45,7 @@
group=root
mode=644
#when: scope == 'all'
tags
:
Config
notify
:
'
Proxy
|
Restart
HAProxy'
-
name
:
"
Proxy
|
Install
update
php
script"
...
...
This diff is collapsed.
Click to expand it.
templates/haproxy_cfg
+
36
−
18
View file @
b83bb899
...
...
@@ -54,8 +54,22 @@ frontend http_in
bind *:80
acl blockedip src -i -f /etc/haproxy/blacklist
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}} }
{% 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}} }
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% if kibana_users is defined %}
acl kibana_present hdr
_dom
(host) -i '{{ 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
{% endif %}
{% if varnish_host|default(false) %}
...
...
@@ -63,18 +77,13 @@ frontend http_in
use_backend backend_varnish if static_content
{% endif %}
{% for host in groups['all'] %}
{% for redirect in hostvars[host].proxy_redirect|default([]) %}
redirect prefix http://{{redirect.to}} if { hdr_dom(host) -i {{redirect.from}} }
{% endfor %}
{% endfor %}
{% for host in groups['all'] %}
acl domain_in_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.list
acl domain_in_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.list
use_backend backend_{{host}} if domain_in_{{host}}
{% if hostvars[host].proxy_crm_domains is defined %}
acl crm_domain_in_{{host}} hdr
_dom
(host) -i -f /etc/haproxy/{{host}}.crm.list
acl crm_domain_in_{{host}} hdr(host) -i
-n
-f /etc/haproxy/{{host}}.crm.list
use_backend backend_{{host}} if crm_domain_in_{{host}}
{% endif %}
acl redirect_ssl_{{host}} hdr
_dom
(host) -i -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}}
{% endfor %}
{% for cert in proxy_certificates %}
...
...
@@ -83,8 +92,22 @@ frontend https_in_{{ cert.ip }}
bind {{ cert.ip }}:443 ssl crt /etc/haproxy/certs/{{ cert.file }} no-sslv3
acl blockedip src -i -f /etc/haproxy/blacklist
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}} }
{% 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}} }
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% if kibana_users is defined %}
acl kibana_present hdr
_dom
(host) -i '{{ kibana_domain|default(inventory_hostname) }}'
acl kibana_present hdr(host) -i
-n
'{{ kibana_domain|default(inventory_hostname) }}'
use_backend backend_kibana if kibana_present
{% endif %}
{% if varnish_host|default(false) %}
...
...
@@ -92,17 +115,12 @@ frontend https_in_{{ cert.ip }}
use_backend backend_varnish if static_content
{% endif %}
{% for host in groups['all'] %}
{% for redirect in hostvars[host].proxy_redirect|default([]) %}
redirect prefix https://{{redirect.to}} if { hdr_dom(host) -i {{redirect.from}} }
{% endfor %}
{% endfor %}
{% for host in groups['all'] %}
acl ssl_domain_in_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.ssl.list
acl ssl_domain_in_{{host}} hdr(host) -i -n -f /etc/haproxy/{{host}}.ssl.list
use_backend backend_{{host}} if ssl_domain_in_{{host}}
acl redirect_{{host}} hdr
_dom
(host) -i -f /etc/haproxy/{{host}}.list
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 %}
acl crm_redirect_{{host}} hdr
_dom
(host) -i -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}}
{% endif %}
{% endfor %}
...
...
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