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 2 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
34 changes: 7 additions & 27 deletions request/load_balancer_reverse_proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,19 @@ and which reverse proxy IP addresses will be doing this type of thing:

.. 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">
.. code-block:: diff
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, diff does not work (we need #7806 for it). We should rewrite the example a bit and use the common php code block instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change it to fit the needs? I'm not sure how this parser works.


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

.. code-block:: php
// ...
$request = Request::createFromGlobals();
+ Request::setTrustedProxies(['127.0.0.1', '10.0.0.0/8']);

// 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