Keep the port in redirects of PHP apps behind nginx on a custom port

Debian's nginx security update now passes HTTP_HOST as $host in fastcgi_params, which drops the port. Wallabag, Investbrain, Invoice Ninja, Poznote and WatchState then redirected to port 80 and the browser got connection refused. Pass $http_host again after the include.
This commit is contained in:
MickLesk committed 2026-11-15 15:57:29 +01:00
1 parent 1eeb23cf9e
commit 1cb07b7d2a
5 files changed
+5

No files matched your search

+1
View File
@@ -139,6 +139,7 @@ server {
fastcgi_pass unix:${PHP_SOCK};
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
include fastcgi_params;
fastcgi_param HTTP_HOST \$http_host;
fastcgi_hide_header X-Powered-By;
fastcgi_read_timeout 300;
}
+1
View File
@@ -134,6 +134,7 @@ server {
fastcgi_pass unix:__PHP_SOCK__;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param HTTP_HOST $http_host;
fastcgi_param HTTP_X_FORWARDED_HOST $http_host;
fastcgi_param HTTP_X_FORWARDED_PROTO $scheme;
fastcgi_read_timeout 300;
+1
View File
@@ -101,6 +101,7 @@ server {
location ~ \.php$ {
include fastcgi_params;
fastcgi_param HTTP_HOST \$http_host;
fastcgi_pass unix:${PHP_SOCK};
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT \$document_root;
+1
View File
@@ -114,6 +114,7 @@ server {
fastcgi_pass unix:__PHP_SOCK__;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param HTTP_HOST $http_host;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
+1
View File
@@ -66,6 +66,7 @@ server {
fastcgi_pass unix:${PHP_SOCK};
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
include fastcgi_params;
fastcgi_param HTTP_HOST \$http_host;
fastcgi_read_timeout 600;
}
}