fix nginx redirect loop

This commit is contained in:
2026-03-22 18:12:18 +01:00
parent b918e713e5
commit 1c2fb3c807

View File

@@ -35,20 +35,9 @@ server {
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Serve static files directly, fall through to PHP for dynamic assets (e.g. theming) # PHP handling (must be before static file locations so that internal
location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ { # redirects like /index.php/apps/theming/theme/dark.css match here
try_files $uri /index.php$request_uri; # instead of cycling back into the static file try_files)
add_header Cache-Control "public, max-age=15778463$asset_immutable";
access_log off;
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d;
access_log off;
}
# PHP handling
location ~ \.php(?:$|/) { location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info; set $path_info $fastcgi_path_info;
@@ -66,6 +55,19 @@ server {
fastcgi_max_temp_file_size 0; fastcgi_max_temp_file_size 0;
} }
# Serve static files directly, fall through to PHP for dynamic assets (e.g. theming)
location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463$asset_immutable";
access_log off;
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d;
access_log off;
}
# Default handler — route everything else through PHP front controller # Default handler — route everything else through PHP front controller
location / { location / {
rewrite ^ /index.php$request_uri last; rewrite ^ /index.php$request_uri last;