Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Added a minor help note about Request::setTrustedProxies#7382

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
javiereguiluz wants to merge2 commits intosymfony:2.7fromjaviereguiluz:fix_6198
Closed
Changes fromall 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
13 changes: 7 additions & 6 deletionscomponents/http_foundation/trusting_proxies.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,19 +17,20 @@ the actual host may be stored in an ``X-Forwarded-Host`` header.

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

.. versionadded:: 2.3
CIDR notation support was introduced in Symfony 2.3, so you can whitelist whole
subnets (e.g. ``10.0.0.0/8``, ``fc00::/7``).
your proxy as follows:
Copy link
Member

Choose a reason for hiding this comment

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

Should we move theversionadded block somewhere as it may not read a bit weird with the colon here?

javiereguiluz reacted with thumbs up emoji

.. code-block:: php

use Symfony\Component\HttpFoundation\Request;

// only trust proxy headers coming from this IP addresses
// put this code as early as possible in your application (e.g. in your
// front controller) to only trust proxy headers coming from these IP addresses
Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));

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

You should also make sure that your proxy filters unauthorized use of these
headers, e.g. if a proxy natively uses the ``X-Forwarded-For`` header, it
should not allow clients to send ``Forwarded`` headers to Symfony.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp