Skip to content

Commit ebf4ea8

Browse files
phansysweaverryan
authored andcommitted
For Nginx in PROD env, this makes more difficult to know that app is running Symfony.
app.php is widely known as our default front controller. It is a small effort by security through obscurity. For Apache, this 301 must be replaced by 404: https://github.com/symfony/symfony-standard/blob/77ee2a83c085169e0bd221510b5693dca504f682/web/.htaccess#L37 | Q | A | ------------- | --- | Doc fix? | no | New feature? | no | Applies to | 2.0+ | Tests pass? | yes | Fixed tickets |
1 parent 42abc66 commit ebf4ea8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cookbook/configuration/web_server_configuration.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ are:
202202
server_name domain.tld www.domain.tld;
203203
root /var/www/project/web;
204204
205+
if ($request_uri ~ "/app\.php(/|$)") {
206+
# prevent explicit access and hide front controller
207+
# remove this block if you want to allow uri's like
208+
# http://domain.tld/app.php/some-path
209+
return 404;
210+
}
211+
205212
location / {
206213
# try to serve file directly, fallback to app.php
207214
try_files $uri /app.php$is_args$args;

0 commit comments

Comments
 (0)