Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 as follows: | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Should we move the | ||
| .. code-block:: php | ||
| use Symfony\Component\HttpFoundation\Request; | ||
| // 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. | ||