Adjust auth confs to fix cookie header conflict

This commit is contained in:
Eric Nemchik 2023-04-27 18:48:27 +00:00 committed by GitHub
parent 9cdedad1c8
commit d8f252dd73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 133 additions and 44 deletions

View file

@ -1,28 +1,27 @@
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-location.conf.sample
## Version 2023/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-location.conf.sample
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
# Rename /config/nginx/proxy-confs/authelia.subdomain.conf.sample to /config/nginx/proxy-confs/authelia.subdomain.conf
# Make sure that the authelia configuration.yml has 'path: "authelia"' defined
## Send a subrequest to Authelia to verify if the user is authenticated and has permission to access the resource.
auth_request /authelia/api/authz/auth-request;
auth_request /authelia/api/verify;
## If the subreqest returns 200 pass to the backend, if the subrequest returns 401 redirect to the portal.
error_page 401 = @authelia_proxy_signin;
## Translate response headers from Authelia into variables
## Translate the user information response headers from the auth subrequest into variables
auth_request_set $email $upstream_http_remote_email;
auth_request_set $groups $upstream_http_remote_groups;
auth_request_set $name $upstream_http_remote_name;
auth_request_set $user $upstream_http_remote_user;
## Inject the response header variables into the request made to the actual upstream
## Inject the user information into the request made to the actual upstream
proxy_set_header Remote-Email $email;
proxy_set_header Remote-Groups $groups;
proxy_set_header Remote-Name $name;
proxy_set_header Remote-User $user;
## Include the Set-Cookie header if present.
## Translate the Set-Cookie response header from auth subrequest into a variable
auth_request_set $set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;
## Set $redirection_url to the location header of the response from the auth request
## Translate the Location response header from auth subrequest into a variable
auth_request_set $redirection_url $upstream_http_location;

View file

@ -1,4 +1,4 @@
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-server.conf.sample
## Version 2023/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-server.conf.sample
# Make sure that your authelia container is in the same user defined bridge network and is named authelia
# Rename /config/nginx/proxy-confs/authelia.subdomain.conf.sample to /config/nginx/proxy-confs/authelia.subdomain.conf
# Make sure that the authelia configuration.yml has 'path: "authelia"' defined
@ -11,8 +11,7 @@ location ^~ /authelia {
set $upstream_authelia authelia;
proxy_pass http://$upstream_authelia:9091;
## Include the Set-Cookie header if present.
auth_request_set $set_cookie $upstream_http_set_cookie;
## Include the Set-Cookie header if present
add_header Set-Cookie $set_cookie;
proxy_pass_request_body off;
@ -23,8 +22,7 @@ location ^~ /authelia {
location @authelia_proxy_signin {
internal;
## Include the Set-Cookie header if present.
auth_request_set $set_cookie $upstream_http_set_cookie;
## Include the Set-Cookie header if present
add_header Set-Cookie $set_cookie;
## Set the $target_url variable based on the original request.

View file

@ -1,4 +1,4 @@
## Version 2023/04/13 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-location.conf.sample
## Version 2023/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-location.conf.sample
# Make sure that your authentik container is in the same user defined bridge network and is named authentik-server
# Rename /config/nginx/proxy-confs/authentik.subdomain.conf.sample to /config/nginx/proxy-confs/authentik.subdomain.conf
@ -7,20 +7,19 @@ auth_request /outpost.goauthentik.io/auth/nginx;
## If the subreqest returns 200 pass to the backend, if the subrequest returns 401 redirect to the portal.
error_page 401 = @goauthentik_proxy_signin;
## Translate response headers from Authentik into variables
## Translate the user information response headers from the auth subrequest into variables
auth_request_set $authentik_email $upstream_http_x_authentik_email;
auth_request_set $authentik_groups $upstream_http_x_authentik_groups;
auth_request_set $authentik_name $upstream_http_x_authentik_name;
auth_request_set $authentik_uid $upstream_http_x_authentik_uid;
auth_request_set $authentik_username $upstream_http_x_authentik_username;
## Inject the response header variables into the request made to the actual upstream
## Inject the user information into the request made to the actual upstream
proxy_set_header X-authentik-email $authentik_email;
proxy_set_header X-authentik-groups $authentik_groups;
proxy_set_header X-authentik-name $authentik_name;
proxy_set_header X-authentik-uid $authentik_uid;
proxy_set_header X-authentik-username $authentik_username;
## Include the Set-Cookie header if present.
## Translate the Set-Cookie response header from auth subrequest into a variable
auth_request_set $set_cookie $upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;

View file

@ -1,4 +1,4 @@
## Version 2023/04/24 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-server.conf.sample
## Version 2023/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-server.conf.sample
# Make sure that your authentik container is in the same user defined bridge network and is named authentik-server
# Rename /config/nginx/proxy-confs/authentik.subdomain.conf.sample to /config/nginx/proxy-confs/authentik.subdomain.conf
@ -10,8 +10,7 @@ location ^~ /outpost.goauthentik.io {
set $upstream_authentik authentik-server;
proxy_pass http://$upstream_authentik:9000;
## Include the Set-Cookie header if present.
auth_request_set $set_cookie $upstream_http_set_cookie;
## Include the Set-Cookie header if present
add_header Set-Cookie $set_cookie;
proxy_pass_request_body off;
@ -22,8 +21,7 @@ location ^~ /outpost.goauthentik.io {
location @goauthentik_proxy_signin {
internal;
## Include the Set-Cookie header if present.
auth_request_set $set_cookie $upstream_http_set_cookie;
## Include the Set-Cookie header if present
add_header Set-Cookie $set_cookie;
## Set the $target_url variable based on the original request.