From 5e08600d2f468ded8fe72ce978beb67a34c41d6b Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Wed, 16 Aug 2017 23:38:43 -0300 Subject: [PATCH] Use variable request_uri as redirect after auth --- controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index b2268ccb64..e8d8a8f27c 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -350,7 +350,6 @@ http { client_max_body_size "{{ $location.Proxy.BodySize }}"; - set $target {{ $location.ExternalAuth.URL }}; proxy_pass $target; } @@ -378,13 +377,15 @@ http { {{ if not (empty $authPath) }} # this location requires authentication auth_request {{ $authPath }}; + auth_request_set $auth_cookie $upstream_http_set_cookie; + add_header Set-Cookie $auth_cookie; {{- range $idx, $line := buildAuthResponseHeaders $location }} {{ $line }} {{- end }} {{ end }} {{ if not (empty $location.ExternalAuth.SigninURL) }} - error_page 401 = {{ $location.ExternalAuth.SigninURL }}; + error_page 401 = {{ $location.ExternalAuth.SigninURL }}?rd=$request_uri; {{ end }}