Skip to content

Commit

Permalink
Docker test: Middleware does not allow overriding the APP_ENV with an…
Browse files Browse the repository at this point in the history
… env var. Setting it in the Apache file for now. This will be fixed in the Symfony6 upgrade
  • Loading branch information
quartje committed Dec 13, 2023
1 parent 28986d4 commit 32ea74e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY config/packages/prod/monolog.yaml.docker config/packages/prod/monolog.yaml

# Add the config files for Apache2
RUN rm -rf /etc/apache2/sites-enabled/*
COPY ./docker/conf/middleware-apache2.conf /etc/apache2/sites-enabled/middleware.conf
COPY ./docker/conf/middleware-test-apache2.conf /etc/apache2/sites-enabled/middleware.conf

# Recreate the cache directory and set the correct permissions
RUN rm -rf /var/www/html/var/cache/prod && \
Expand Down
34 changes: 34 additions & 0 deletions docker/conf/middleware-test-apache2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Virtualhost *:80>
ServerName middleware
ServerAdmin [email protected]

DocumentRoot /var/www/html/public
SetEnv HTTPS on
SetEnv APP_ENV test
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

<Directory "/var/www/html/public">
Require all granted

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
<Location />
Require all granted
</Location>

Header always set X-Content-Type-Options "nosniff"

# Set the php application handler so mod_php interpets the files
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

ExpiresActive on
ExpiresByType font/* "access plus 1 year"
ExpiresByType image/* "access plus 6 months"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/js "access plus 1 year"
</VirtualHost>

0 comments on commit 32ea74e

Please sign in to comment.