Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add information about CIDR notation support in trusted proxy list #2287

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 26, 2013
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
12 changes: 9 additions & 3 deletions 12 components/http_foundation/trusting_proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ stored in a ``X-Forwarded-Host`` header.

Since HTTP headers can be spoofed, Symfony2 does *not* trust these proxy
headers by default. If you are behind a proxy, you should manually whitelist
your proxy::
your proxy.

.. versionadded:: 2.3
CIDR notation support was introduced, so you can whitelist whole
subnets (e.g. ``10.0.0.0/8``, ``fc00::/7``).

.. code-block:: php

use Symfony\Component\HttpFoundation\Request;

$request = Request::createFromGlobals();
// only trust proxy headers coming from this IP address
$request->setTrustedProxies(array(192.0.0.1));
// only trust proxy headers coming from this IP addresses
$request->setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));

Configuring Header Names
------------------------
Expand Down
10 changes: 7 additions & 3 deletions 10 reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,27 @@ trusted_proxies
Configures the IP addresses that should be trusted as proxies. For more details,
see :doc:`/components/http_foundation/trusting_proxies`.

.. versionadded:: 2.3
CIDR notation support was introduced, so you can whitelist whole
subnets (e.g. ``10.0.0.0/8``, ``fc00::/7``).

.. configuration-block::

.. code-block:: yaml

framework:
trusted_proxies: [192.0.0.1]
trusted_proxies: [192.0.0.1, 10.0.0.0/8]

.. code-block:: xml

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

.. code-block:: php

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

.. _reference-framework-form:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.