Skip to content

Commit b9f8a4f

Browse files
committed
minor #7759 Fix trusted hosts example regular expressions (thewilkybarkid)
This PR was merged into the 2.7 branch. Discussion ---------- Fix trusted hosts example regular expressions Allow subdomains but not prefixed domains (eg evilexample.com). Commits ------- e3f038b Fix trusted hosts example regular expressions
2 parents 83ca87f + e3f038b commit b9f8a4f

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy