From f2693fff9d78118892d4bed512beedc268464422 Mon Sep 17 00:00:00 2001
From: Lucas Mirloup <97196064+lucasmirloup@users.noreply.github.com>
Date: Mon, 23 Mar 2026 11:42:10 +0100
Subject: [PATCH] fix(apache): use SetHandler instead of ProxyPassMatch to
preserve response headers set in .htaccess
Inspired from Symfony's recommended Apache configuration: https://symfony.com/doc/current/setup/web_server_configuration.html#apache
---
.gitignore | 1 +
virtualhost.conf | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9f11b75
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea/
diff --git a/virtualhost.conf b/virtualhost.conf
index 64f7200..0b7cd8b 100644
--- a/virtualhost.conf
+++ b/virtualhost.conf
@@ -5,16 +5,18 @@
BrotliCompressionQuality 4
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript image/svg+xml
- UseCanonicalName Off
+ # Sets the HTTP_AUTHORIZATION header removed by Apache
+ SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
- ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://${PHP_CONTAINER_NAME}:9000${DOCUMENT_ROOT}/$1"
+
+ SetHandler proxy:fcgi://${PHP_CONTAINER_NAME}:9000
+
DocumentRoot ${DOCUMENT_ROOT}
- DirectoryIndex index.php
-
- Options FollowSymlinks
AllowOverride All
+ FallbackResource /index.php
+ Options FollowSymlinks
Require all granted