Skip to content

Commit

Permalink
IBX-7818: Fixed direct access to index.php with long URL (#34)
Browse files Browse the repository at this point in the history
* IBX-7818: Fixed direct acces to index.php with long URL

* imagick workaround

* redis 6.0.2

* fixup! imagick workaround
  • Loading branch information
micszo authored Oct 10, 2024
1 parent 805eb8c commit 0e66b93
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion php/Dockerfile-7.3
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ RUN set -xe \
&& docker-php-ext-enable igbinary \
\
# Install redis (manualy build in order to be able to enable igbinary)
&& for i in $(seq 1 3); do pecl install -o --nobuild redis && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& for i in $(seq 1 3); do pecl install -o --nobuild "redis-6.0.2" && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& cd "$(pecl config-get temp_dir)/redis" \
&& phpize \
&& ./configure --enable-redis-igbinary \
Expand Down
15 changes: 12 additions & 3 deletions php/Dockerfile-8.3
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,18 @@ RUN set -xe \
&& docker-php-ext-enable opcache \
&& cp /usr/src/php/php.ini-production ${PHP_INI_DIR}/php.ini \
\
# Install imagemagick
&& for i in $(seq 1 3); do pecl install -o imagick && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& docker-php-ext-enable imagick \
# Imagick is installed from the archive because regular installation fails
# See: https://github.com/Imagick/imagick/issues/643#issuecomment-1834361716
&& curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz \
&& tar --strip-components=1 -xf /tmp/imagick.tar.gz \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \
&& rm -rf /tmp/* \
# <<< End of Imagick installation

# Install xdebug
&& for i in $(seq 1 3); do echo yes | pecl install -o "xdebug" && s=0 && break || s=$? && sleep 1; done; (exit $s) \
# Install blackfire: https://blackfire.io/docs/integrations/docker
Expand Down
2 changes: 1 addition & 1 deletion templates/apache2/vhost.template
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
RewriteRule ^/(css|js|fonts?)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]

# Prevent access to website with direct usage of index.php in URL
RewriteRule ^/([^/]+/)?index\.php([/?#]|$) - [R=404,L]
RewriteRule ^/([^/]+/)*?index\.php([/?#]|$) - [R=404,L]

RewriteRule .* /index.php
</IfModule>
Expand Down
2 changes: 1 addition & 1 deletion templates/nginx/ez_params.d/ez_rewrite_params
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rewrite "^/build/(.*)" "/build/$1" break;
rewrite "^/assets/(.*)" "/assets/$1" break;

# Prevent access to website with direct usage of index.php in URL
if ($request_uri ~ "^/([^/]+/)?index\.php([/?#]|$)") {
if ($request_uri ~ "^/([^/]+/)*?index\.php([/?#]|$)") {
return 404;
}

Expand Down

0 comments on commit 0e66b93

Please sign in to comment.