From aeb73706752fd83a1b724f77eaad5eda6fc5514c Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 20 Oct 2026 13:55:57 +0000 Subject: [PATCH] Update Nginx configuration to replace $http_host with $host$is_request_port$request_port for better compatibility Signed-off-by: GitHub --- readme-vars.yml | 1 + root/defaults/nginx/authelia-server.conf.sample | 4 ++-- root/defaults/nginx/authentik-server.conf.sample | 6 +++--- root/defaults/nginx/proxy.conf.sample | 4 ++-- root/defaults/nginx/tinyauth-server.conf.sample | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index 4b2fa39..688b4a4 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -220,6 +220,7 @@ init_diagram: | "swag:latest" <- Base Images # changelog changelogs: + - {date: "20.10.26:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) proxy.conf, authelia-server.conf, authentik-server.conf, tinyauth-server.conf - Update Nginx configuration to replace $http_host with $host$is_request_port$request_port for better compatibility."} - {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."} diff --git a/root/defaults/nginx/authelia-server.conf.sample b/root/defaults/nginx/authelia-server.conf.sample index d969a05..a3f7652 100644 --- a/root/defaults/nginx/authelia-server.conf.sample +++ b/root/defaults/nginx/authelia-server.conf.sample @@ -1,4 +1,4 @@ -## Version 2025/03/25 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authelia-server.conf.sample +## Version 2026/10/20 - 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 @@ -28,7 +28,7 @@ location @authelia_proxy_signin { add_header Set-Cookie $set_cookie; ## Set the $target_url variable based on the original request - set_escape_uri $target_url $scheme://$http_host$request_uri; + set_escape_uri $target_url $scheme://$host$is_request_port$request_port$request_uri; ## Translate the Location response header from the auth subrequest into a variable auth_request_set $signin_url $upstream_http_location; diff --git a/root/defaults/nginx/authentik-server.conf.sample b/root/defaults/nginx/authentik-server.conf.sample index 7b08ff9..c28ada5 100644 --- a/root/defaults/nginx/authentik-server.conf.sample +++ b/root/defaults/nginx/authentik-server.conf.sample @@ -1,4 +1,4 @@ -## Version 2025/03/25 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/authentik-server.conf.sample +## Version 2026/10/20 - 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 @@ -38,10 +38,10 @@ location @goauthentik_proxy_signin { add_header Set-Cookie $set_cookie; ## Set the $target_url variable based on the original request - set_escape_uri $target_url $scheme://$http_host$request_uri; + set_escape_uri $target_url $scheme://$host$is_request_port$request_port$request_uri; ## Set the $signin_url variable - set $signin_url https://$http_host/outpost.goauthentik.io/start?rd=$target_url; + set $signin_url https://$host$is_request_port$request_port/outpost.goauthentik.io/start?rd=$target_url; ## Redirect to login return 302 $signin_url; diff --git a/root/defaults/nginx/proxy.conf.sample b/root/defaults/nginx/proxy.conf.sample index 967d170..ab863a6 100644 --- a/root/defaults/nginx/proxy.conf.sample +++ b/root/defaults/nginx/proxy.conf.sample @@ -1,4 +1,4 @@ -## Version 2023/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/proxy.conf.sample +## Version 2026/10/20 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/proxy.conf.sample # Timeout if the real server is dead proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; @@ -33,5 +33,5 @@ proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-Uri $request_uri; proxy_set_header X-Original-Method $request_method; -proxy_set_header X-Original-URL $scheme://$http_host$request_uri; +proxy_set_header X-Original-URL $scheme://$host$is_request_port$request_port$request_uri; proxy_set_header X-Real-IP $remote_addr; diff --git a/root/defaults/nginx/tinyauth-server.conf.sample b/root/defaults/nginx/tinyauth-server.conf.sample index bbb2691..387656f 100644 --- a/root/defaults/nginx/tinyauth-server.conf.sample +++ b/root/defaults/nginx/tinyauth-server.conf.sample @@ -1,4 +1,4 @@ -## Version 2026/09/08 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/tinyauth-server.conf.sample +## Version 2026/10/20 - 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 @@ -15,7 +15,7 @@ location /tinyauth { 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-URL $scheme://$host$is_request_port$request_port$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;