Skip to content

Commit

Permalink
Enable mode_headers for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jekkos committed Aug 31, 2021
1 parent 2c9355e commit 1364484
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
17 changes: 10 additions & 7 deletions .htaccess
@@ -1,19 +1,22 @@
# redirect to public page
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
</IfModule>

# disable directory browsing
# For security reasons, Option all cannot be overridden.
Options +SymLinksIfOwnerMatch -Indexes
Header always set X-Frame-Options SAMEORIGIN

# prevent folder listing
IndexIgnore *

<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
</Ifmodule>

# Apache 2.4
<IfModule authz_core_module>
# secure htaccess file
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
openssl


RUN a2enmod rewrite
RUN a2enmod rewrite headers
RUN docker-php-ext-install mysqli bcmath intl gd
RUN echo "date.timezone = \"\${PHP_TIMEZONE}\"" > /usr/local/etc/php/conf.d/timezone.ini

Expand Down
6 changes: 5 additions & 1 deletion public/.htaccess
Expand Up @@ -24,6 +24,10 @@ RewriteRule ^(.*)$ index.php?/$1 [L]
#Options All -Indexes
Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes

<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
</Ifmodule>

# prevent folder listing
IndexIgnore *

Expand Down Expand Up @@ -60,4 +64,4 @@ IndexIgnore *
ExpiresActive On
ExpiresDefault "access plus 1 week"
</FilesMatch>
</IfModule>
</IfModule>

0 comments on commit 1364484

Please sign in to comment.