diff options
| author | Eric Pierce <social@pierce.xyz> | 2024-09-11 21:13:50 +0000 |
|---|---|---|
| committer | Eric Pierce <social@pierce.xyz> | 2024-09-11 21:13:50 +0000 |
| commit | 48db6beca7d6f4562819d727202027d611cccb06 (patch) | |
| tree | 607d2ea9358f900b3a014a991d635061f30e0182 | |
| parent | 1fb202b258c751cb4e64bc38603c67263cc45959 (diff) | |
Update nginx.conf to move the currently unused PATH_INFO configuration into a separate location rule for plugins to leverage
| -rw-r--r-- | .docker/web-nginx/nginx.conf | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/.docker/web-nginx/nginx.conf b/.docker/web-nginx/nginx.conf index 411cbf453..0e4ecbaad 100644 --- a/.docker/web-nginx/nginx.conf +++ b/.docker/web-nginx/nginx.conf @@ -34,6 +34,7 @@ http { rewrite ${APP_BASE}/healthz ${APP_BASE}/public.php?op=healthcheck; + # Regular PHP handling (without PATH_INFO) location ~ \.php$ { # regex to split $uri to $fastcgi_script_name and $fastcgi_path fastcgi_split_path_info ^(.+?\.php)(/.*)$; @@ -41,22 +42,37 @@ http { # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; + fastcgi_index index.php; + include fastcgi.conf; + + set $backend "${APP_UPSTREAM}:9000"; + + fastcgi_pass $backend; + } + + # Allow PATH_INFO for PHP files in plugins.local directories with an /api/ sub directory to allow plugins to leverage when desired + location ~ /plugins\.local/.*/api/.*\.php(/|$) { + # regex to split $uri to $fastcgi_script_name and $fastcgi_path + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + + # Check that the PHP script exists before passing it + try_files $fastcgi_script_name =404; + # Bypass the fact that try_files resets $fastcgi_path_info # see: http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; - fastcgi_index index.php; + fastcgi_index index.php; include fastcgi.conf; set $backend "${APP_UPSTREAM}:9000"; fastcgi_pass $backend; } - + location / { try_files $uri $uri/ =404; } - } } |