Skip to content

Fix trusted hosts example regular expressions #7759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,14 @@ respond and the user will receive a 500 response.
'trusted_hosts' => array('example.com', 'example.org'),
));

Hosts can also be configured using regular expressions (e.g. ``.*\.?example.com$``),
Hosts can also be configured using regular expressions (e.g. ``^(.+\.)?example.com$``),
which make it easier to respond to any subdomain.

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

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

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