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
e82a5fc9
Commit
e82a5fc9
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#6 Implement support for redirect maps based on domain or path
parent
5e708914
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defaults/main.yml
+3
-0
3 additions, 0 deletions
defaults/main.yml
tasks/configure.yml
+12
-0
12 additions, 0 deletions
tasks/configure.yml
templates/haproxy_cfg.jinja2
+4
-0
4 additions, 0 deletions
templates/haproxy_cfg.jinja2
templates/redirect.map.jinja2
+3
-0
3 additions, 0 deletions
templates/redirect.map.jinja2
with
22 additions
and
0 deletions
defaults/main.yml
+
3
−
0
View file @
e82a5fc9
...
...
@@ -8,6 +8,9 @@ proxy_timeout_server: '45s'
proxy_redirect_aliase
:
false
proxy_maxconn
:
100
proxy_varnish_maxconn
:
1000
proxy_redirect_maps
:
domain
:
{}
path
:
{}
proxy_blacklist
:
ip
:
-
'
146.185.176.158'
...
...
This diff is collapsed.
Click to expand it.
tasks/configure.yml
+
12
−
0
View file @
e82a5fc9
...
...
@@ -105,6 +105,18 @@
when
:
haproxy_private is defined and haproxy_private.domain is defined
notify
:
"
Check
HAProxy
Config"
-
name
:
"
Update
redirect
map
files"
template
:
src='redirect.map.jinja2'
dest='/etc/haproxy/redirect.{{ item }}.map'
owner='root'
group='root'
mode='644'
with_items
:
-
'
domain'
-
'
path'
notify
:
"
Check
HAProxy
Config"
-
name
:
"
Create
config
file"
template
:
src='haproxy_cfg.jinja2'
...
...
This diff is collapsed.
Click to expand it.
templates/haproxy_cfg.jinja2
+
4
−
0
View file @
e82a5fc9
...
...
@@ -60,6 +60,8 @@ userlist notprivate
frontend http_in
bind *:80
http-request del-header Proxy
http-request redirect code 301 location %[hdr(host),map(/etc/haproxy/redirect.domain.map)] if { hdr(host),map(/etc/haproxy/redirect.domain.map) -m found }
http-request redirect code 301 location %[capture.req.uri,map(/etc/haproxy/redirect.path.map)] if { capture.req.uri,map(/etc/haproxy/redirect.path.map) -m found }
{% if haproxy_private is defined %}
{% if haproxy_private.domain is defined %}
acl privatedomain hdr(host) -i -n -f /etc/haproxy/privatelist.domain
...
...
@@ -187,6 +189,8 @@ frontend http_in
frontend https_in_{{ cert.ip }}
bind {{ cert.ip }}:443 ssl crt /etc/haproxy/certs/{{ cert.file }} no-sslv3
http-request del-header Proxy
http-request redirect code 301 location %[hdr(host),map(/etc/haproxy/redirect.domain.map)] if { hdr(host),map(/etc/haproxy/redirect.domain.map) -m found }
http-request redirect code 301 location %[capture.req.uri,map(/etc/haproxy/redirect.path.map)] if { capture.req.uri,map(/etc/haproxy/redirect.path.map) -m found }
{% if haproxy_private is defined %}
{% if haproxy_private.domain is defined %}
acl privatedomain hdr(host) -i -n -f /etc/haproxy/privatelist.domain
...
...
This diff is collapsed.
Click to expand it.
templates/redirect.map.jinja2
0 → 100644
+
3
−
0
View file @
e82a5fc9
{% for key in proxy_redirect_maps[item] %}
{{ key }} {{ proxy_redirect_maps[item][key] }}
{% 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