Skip to content

Remove deprecated trusted_proxies config option #7868

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
39 changes: 0 additions & 39 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Configuration

* `secret`_
* `http_method_override`_
* `trusted_proxies`_
* `ide`_
* `test`_
* `default_locale`_
Expand Down Expand Up @@ -184,44 +183,6 @@ named ``kernel.http_method_override``.
$request = Request::createFromGlobals();
// ...

.. _reference-framework-trusted-proxies:

trusted_proxies
~~~~~~~~~~~~~~~

**type**: ``array``

Configures the IP addresses that should be trusted as proxies. For more
details, see :doc:`/request/load_balancer_reverse_proxy`.

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
framework:
trusted_proxies: [192.0.0.1, 10.0.0.0/8]

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config trusted-proxies="192.0.0.1, 10.0.0.0/8" />
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', array(
'trusted_proxies' => array('192.0.0.1', '10.0.0.0/8'),
));

ide
~~~

Expand Down
37 changes: 9 additions & 28 deletions request/load_balancer_reverse_proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,22 @@ Solution: trusted_proxies
This is no problem, but you *do* need to tell Symfony what is happening
and which reverse proxy IP addresses will be doing this type of thing:

.. configuration-block::
.. code-block:: php

.. code-block:: yaml
// web/app.php

# app/config/config.yml
# ...
framework:
trusted_proxies: [192.0.0.1, 10.0.0.0/8]
// ...
$request = Request::createFromGlobals();

.. code-block:: xml
// use the setTrustedProxies() method to tell Symfony
// about your reverse proxy IP addresses
Request::setTrustedProxies(['127.0.0.1', '10.0.0.0/8']);

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config trusted-proxies="192.0.0.1, 10.0.0.0/8">
<!-- ... -->
</framework:config>
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', array(
'trusted_proxies' => array('192.0.0.1', '10.0.0.0/8'),
));
// ...

In this example, you're saying that your reverse proxy (or proxies) has
the IP address ``192.0.0.1`` or matches the range of IP addresses that use
the CIDR notation ``10.0.0.0/8``. For more details, see the
:ref:`framework.trusted_proxies <reference-framework-trusted-proxies>` option.
the CIDR notation ``10.0.0.0/8``.

You are also saying that you trust that the proxy does not send conflicting
headers, e.g. sending both ``X-Forwarded-For`` and ``Forwarded`` in the same
Expand Down