mirror of
https://github.com/linuxserver/docker-swag.git
synced 2026-09-26 02:24:51 +09:00
Merge pull request #621 from steveiliop56/refactor/x-tinyauth-location
refactor: use x-tinyauth-location header and remove dupe auth modules in tinyauth auth request
This commit is contained in:
+2
-1
@@ -220,7 +220,8 @@ init_diagram: |
|
||||
"swag:latest" <- Base Images
|
||||
# changelog
|
||||
changelogs:
|
||||
- {date: "19.07.26:", desc: "Rebase to Alpine 3.24 with PHP 8.5."}
|
||||
- {date: "09.09.26:", desc: "Use new X-Tinyauth-Location header in Tinyauth locations and remove duplicate auth module headers."}
|
||||
- {date: "19.07.26:", desc: "Rebase to Alpine 3.24 with PHP 8.5."}
|
||||
- {date: "10.07.26:", desc: "Add support for Let's Encrypt cert profiles. Run certbot twice daily with a random delay."}
|
||||
- {date: "19.06.26:", desc: "Add support for mijn.host dns validation."}
|
||||
- {date: "01.06.26:", desc: "Remove obsolete old cert check logic."}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
## Version 2025/12/17 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/tinyauth-location.conf.sample
|
||||
## Version 2026/07/19 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/tinyauth-location.conf.sample
|
||||
# Make sure that your tinyauth container is in the same user defined bridge network and is named tinyauth
|
||||
# Rename /config/nginx/proxy-confs/tinyauth.subdomain.conf.sample to /config/nginx/proxy-confs/tinyauth.subdomain.conf
|
||||
|
||||
## Send a subrequest to tinyauth to verify if the user is authenticated and has permission to access the resource
|
||||
auth_request /tinyauth;
|
||||
|
||||
## If the subreqest returns 200 pass to the backend, if the subrequest returns 401 redirect to the portal
|
||||
error_page 401 = @tinyauth_login;
|
||||
auth_request_set $redirection_url $upstream_http_x_tinyauth_location;
|
||||
error_page 401 403 =302 $redirection_url;
|
||||
|
||||
## Translate the user information response headers from the auth subrequest into variables
|
||||
auth_request_set $email $upstream_http_remote_email;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Version 2025/06/08 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/tinyauth-server.conf.sample
|
||||
## Version 2026/09/08 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/tinyauth-server.conf.sample
|
||||
# Make sure that your tinyauth container is in the same user defined bridge network and is named tinyauth
|
||||
# Rename /config/nginx/proxy-confs/tinyauth.subdomain.conf.sample to /config/nginx/proxy-confs/tinyauth.subdomain.conf
|
||||
|
||||
@@ -6,30 +6,17 @@
|
||||
location /tinyauth {
|
||||
internal;
|
||||
|
||||
include /config/nginx/proxy.conf;
|
||||
include /config/nginx/resolver.conf;
|
||||
set $upstream_tinyauth tinyauth;
|
||||
proxy_pass http://$upstream_tinyauth:3000/api/auth/nginx;
|
||||
|
||||
proxy_set_header x-forwarded-proto $scheme;
|
||||
proxy_set_header x-forwarded-host $http_host;
|
||||
proxy_set_header x-forwarded-uri $request_uri;
|
||||
}
|
||||
|
||||
# virtual location for tinyauth 401 redirects
|
||||
location @tinyauth_login {
|
||||
internal;
|
||||
|
||||
## Set the $target_url variable based on the original request
|
||||
set_escape_uri $target_url $scheme://$http_host$request_uri;
|
||||
|
||||
## Set the $signin_url variable
|
||||
set $domain $host;
|
||||
if ($host ~* "^[^.]+\.([^.]+\..+)$") {
|
||||
set $domain $1;
|
||||
}
|
||||
set $signin_url https://tinyauth.$domain/login?redirect_uri=$target_url;
|
||||
|
||||
## Redirect to login
|
||||
return 302 $signin_url;
|
||||
# Don't send the body to the auth server
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
|
||||
# Headers needed for authentication
|
||||
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
|
||||
proxy_set_header X-Original-Method $request_method;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user