Merge ~hloeung/content-cache-charm:master into content-cache-charm:master
Status: | Merged |
---|---|
Approved by: | Tom Haddon |
Approved revision: | b274f7d4d4151212a5a9fa3752312d87f398c7b3 |
Merged at revision: | 687d6d03ad15df2a82145e9744a202f11ec3d3f3 |
Proposed branch: | ~hloeung/content-cache-charm:master |
Merge into: | content-cache-charm:master |
Diff against target: |
40 lines (+14/-1) 2 files modified
lib/haproxy.py (+11/-0) tests/unit/files/haproxy_config_rendered_listen_stanzas_test_output3.txt (+3/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tom Haddon | Approve | ||
Canonical IS Reviewers | Pending | ||
Review via email: mp+388792@code.launchpad.net |
Commit message
Fix default site being a redirect
Description of the change
HAProxy processes redirects before any backend configs (use_backend or
default_backend). With this, the 'use_backend' line in the example
below is never used:
| listen combined-80
| bind 0.0.0.0:80
| bind :::80
| redirect scheme https code 301 if { hdr(Host) -i site1.local } !{ ssl_fc }
| use_backend backend-site2-http if { hdr(Host) -i site2.local }
| redirect prefix https:/
So any requests for site2.local will always hit the redirect
prefix. Instead, we need to create a new backend with the redirect
rule like so:
| listen combined-80
| bind 0.0.0.0:80
| bind :::80
| redirect scheme https code 301 if { hdr(Host) -i site1.local } !{ ssl_fc }
| use_backend backend-site2-http if { hdr(Host) -i site2.local }
| default backend-
|
| backend backend-
| redirect prefix https:/
This merge proposal is being monitored by mergebot. Change the status to Approved to merge.