Commit 2166ecb0 authored by Vincent Pelletier's avatar Vincent Pelletier

WIP stack/erp5/haproxy.cfg.in: De-hardcode request ip and port in rewritetules

WIP: Host header is not sanitised by haproxy:
  curl -vk --header 'Host: 10.0.11.117:2150/unit_test_0/VirtualHostRoot/vh_unit_test_0/?' https://10.0.11.117:2150/unit_test_0/vincent/

Instead, use the requests' Host header.
This allows accessing the balancer under any name, including ones not
expected by the backend.
parent 341c36d5
......@@ -98,7 +98,7 @@ md5sum = 409a7505548576ebf0e4d5cc218e0753
[template-haproxy-cfg]
filename = haproxy.cfg.in
md5sum = 2cd76971b64b0bf7771978ad07bfc2e5
md5sum = bdb624dcc3571e4280d2cb2cc7cd7a15
[template-rsyslogd-cfg]
filename = rsyslogd.cfg.in
......
......@@ -261,7 +261,7 @@ frontend frontend_{{ group_name }}
{% for name, url in sorted(backend_dict.items()) %}
backend backend_{{ group_name }}_{{ name }}
http-request replace-path ^/{{ name }}(.*) /VirtualHostBase/https/{{ ip }}:{{ port }}/VirtualHostRoot/_vh_{{ name }}\1
http-request replace-path ^/{{ name }}(.*) /VirtualHostBase/https/%[req.hdr(Host)]/VirtualHostRoot/_vh_{{ name }}\1
timeout server 8h
server {{ name }} {{ urllib_parse.urlparse(url).netloc }}
{%- endfor %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment