Skip to content

Commit e3f038b

Browse files
Fix trusted hosts example regular expressions
Allow subdomains but not prefixed domains (eg evilexample.com)
1 parent f3eaa80 commit e3f038b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reference/configuration/framework.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ respond and the user will receive a 500 response.
362362
'trusted_hosts' => array('example.com', 'example.org'),
363363
));
364364
365-
Hosts can also be configured using regular expressions (e.g. ``.*\.?example.com$``),
365+
Hosts can also be configured using regular expressions (e.g. ``^(.+\.)?example.com$``),
366366
which make it easier to respond to any subdomain.
367367

368368
In addition, you can also set the trusted hosts in the front controller
369369
using the ``Request::setTrustedHosts()`` method::
370370

371371
// web/app.php
372-
Request::setTrustedHosts(array('.*\.?example.com$', '.*\.?example.org$'));
372+
Request::setTrustedHosts(array('^(.+\.)?example.com$', '^(.+\.)?example.org$'));
373373

374374
The default value for this option is an empty array, meaning that the application
375375
can respond to any given host.

0 commit comments

Comments
 (0)