Backwards compatibility and additional cookie handling tweaks

This commit is contained in:
Eric Nemchik
2023-04-27 19:34:14 +00:00
committed by GitHub
parent d8f252dd73
commit a2e3c8b9fb
4 changed files with 24 additions and 19 deletions

View File

@@ -12,6 +12,7 @@ location ^~ /authelia {
proxy_pass http://$upstream_authelia:9091;
## Include the Set-Cookie header if present
auth_request_set $set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;
proxy_pass_request_body off;
@@ -23,16 +24,20 @@ location @authelia_proxy_signin {
internal;
## Include the Set-Cookie header if present
auth_request_set $set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;
## Set the $target_url variable based on the original request.
## Set the $target_url variable based on the original request
set_escape_uri $target_url $scheme://$http_host$request_uri;
## Set $redirection_url if it is empty
if ($redirection_url = false) {
set $redirection_url https://$http_host/authelia/?rd=$target_url;
## Translate the Location response header from the auth subrequest into a variable
auth_request_set $signin_url $upstream_http_location;
if ($signin_url = '') {
## Set the $signin_url variable
set $signin_url https://$http_host/authelia/?rd=$target_url;
}
## Redirect to login
return 302 $redirection_url;
return 302 $signin_url;
}