From 421882389d5e5c80b4350b15b3bfde69ef271658 Mon Sep 17 00:00:00 2001 From: Philip Henning Date: Mon, 15 Jul 2019 18:58:35 +0200 Subject: [PATCH] Proxy cookie path (#150) * Add proxy_cookie_path directive to rewrite the cookie path * delete unnecessary spacing --- README.md | 3 +++ defaults/main.yml | 3 +++ templates/http/default.conf.j2 | 3 +++ tests/playbooks/nginx-http-template.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 6094537..15d7f62 100644 --- a/README.md +++ b/README.md @@ -506,6 +506,9 @@ nginx_http_template: proxy_ignore_headers: - Vary - Cache-Control + proxy_cookie_path: + path: /web/ + replacement: / proxy_buffering: false proxy_http_version: 1.0 websocket: false diff --git a/defaults/main.yml b/defaults/main.yml index 5b34c44..1cd312b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -318,6 +318,9 @@ nginx_http_template: proxy_ignore_headers: - Vary - Cache-Control + proxy_cookie_path: + path: /web/ + replacement: / proxy_buffering: false proxy_http_version: 1.0 websocket: false diff --git a/templates/http/default.conf.j2 b/templates/http/default.conf.j2 index e5105bc..db99ab1 100644 --- a/templates/http/default.conf.j2 +++ b/templates/http/default.conf.j2 @@ -254,6 +254,9 @@ server { {% if item.value.reverse_proxy.locations[location].proxy_ignore_headers is defined %} proxy_ignore_headers {{ item.value.reverse_proxy.locations[location].proxy_ignore_headers | join(" ") }}; {% endif %} +{% if item.value.reverse_proxy.locations[location].proxy_cookie_path is defined %} + proxy_cookie_path {{ item.value.reverse_proxy.locations[location].proxy_cookie_path.path }} {{ item.value.reverse_proxy.locations[location].proxy_cookie_path.replacement }}; +{% endif %} {% if item.value.reverse_proxy.locations[location].proxy_buffering is defined %} proxy_buffering {{ item.value.reverse_proxy.locations[location].proxy_buffering | ternary("on", "off") }}; {% endif %} diff --git a/tests/playbooks/nginx-http-template.yml b/tests/playbooks/nginx-http-template.yml index 6a4eb3b..f11b775 100644 --- a/tests/playbooks/nginx-http-template.yml +++ b/tests/playbooks/nginx-http-template.yml @@ -119,6 +119,9 @@ header_x_forwarded_proto: name: X-Forwarded-Proto value: $scheme + proxy_cookie_path: + path: /web/ + replacement: / upstreams: frontend_upstream: name: frontend_servers