Skip to content

Use the reserved domains example.com and example.org #5321

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 2 commits into from
Jun 9, 2015
Merged
Show file tree
Hide file tree
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: 4 additions & 0 deletions contributing/documentation/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Code Examples
Unless the example requires a custom bundle, make sure to always use the
``AppBundle`` bundle to store your code;
* Use ``Acme`` when the code requires a vendor name;
* Use ``example.com`` as the domain of sample URLs and ``example.org`` and
``example.net`` when additional domains are required. All of these domains are
`reserved by the IANA`_.
* To avoid horizontal scrolling on code blocks, we prefer to break a line
correctly if it crosses the 85th character;
* When you fold one or more lines of code, place ``...`` in a comment at the point
Expand Down Expand Up @@ -174,6 +177,7 @@ In addition, documentation follows these rules:

.. _`the Sphinx documentation`: http://sphinx-doc.org/rest.html#source-code
.. _`Twig Coding Standards`: http://twig.sensiolabs.org/doc/coding_standards.html
.. _`reserved by the IANA`: http://tools.ietf.org/html/rfc2606#section-3
.. _`American English`: http://en.wikipedia.org/wiki/American_English
.. _`American English Oxford Dictionary`: http://www.oxforddictionaries.com/definition/american_english/
.. _`headings and titles`: http://en.wikipedia.org/wiki/Letter_case#Headings_and_publication_titles
Expand Down
12 changes: 6 additions & 6 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ respond and the user will receive a 500 response.

# app/config/config.yml
framework:
trusted_hosts: ['acme.com', 'acme.org']
trusted_hosts: ['example.com', 'example.org']

.. code-block:: xml

Expand All @@ -296,8 +296,8 @@ respond and the user will receive a 500 response.
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<trusted-host>acme.com</trusted-host>
<trusted-host>acme.org</trusted-host>
<trusted-host>example.com</trusted-host>
<trusted-host>example.org</trusted-host>
<!-- ... -->
</framework>
</container>
Expand All @@ -306,17 +306,17 @@ respond and the user will receive a 500 response.

// app/config/config.php
$container->loadFromExtension('framework', array(
'trusted_hosts' => array('acme.com', 'acme.org'),
'trusted_hosts' => array('example.com', 'example.org'),
));

Hosts can also be configured using regular expressions (e.g. ``.*\.?acme.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('.*\.?acme.com$', '.*\.?acme.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