Merge pull request #1164 from aledbf/oauth2-auth

Use variable request_uri as redirect after auth
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-08-17 18:03:21 -04:00 committed by GitHub
commit fe33cd3e46

View file

@ -350,7 +350,6 @@ http {
client_max_body_size "{{ $location.Proxy.BodySize }}"; client_max_body_size "{{ $location.Proxy.BodySize }}";
set $target {{ $location.ExternalAuth.URL }}; set $target {{ $location.ExternalAuth.URL }};
proxy_pass $target; proxy_pass $target;
} }
@ -378,13 +377,15 @@ http {
{{ if not (empty $authPath) }} {{ if not (empty $authPath) }}
# this location requires authentication # this location requires authentication
auth_request {{ $authPath }}; auth_request {{ $authPath }};
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;
{{- range $idx, $line := buildAuthResponseHeaders $location }} {{- range $idx, $line := buildAuthResponseHeaders $location }}
{{ $line }} {{ $line }}
{{- end }} {{- end }}
{{ end }} {{ end }}
{{ if not (empty $location.ExternalAuth.SigninURL) }} {{ if not (empty $location.ExternalAuth.SigninURL) }}
error_page 401 = {{ $location.ExternalAuth.SigninURL }}; error_page 401 = {{ $location.ExternalAuth.SigninURL }}?rd=$request_uri;
{{ end }} {{ end }}