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

Commit a6f4536

Browse filesBrowse files
committed
minor #12117 add support for custom headers when using a proxy (brambaud)
This PR was merged into the 3.4 branch. Discussion ---------- add support for custom headers when using a proxy <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> See symfony/symfony#32961 and symfony/symfony#26333. We should document how to use custom headers when using reverse proxies since `Request::setTrustedHeaderName()` has been deprecated. Commits ------- a63c5a6 add support for custom headers when using a proxy
2 parents c637b7a + a63c5a6 commit a6f4536
Copy full SHA for a6f4536

File tree

1 file changed

+17
-0
lines changed
Filter options

1 file changed

+17
-0
lines changed

‎deployment/proxies.rst

Copy file name to clipboardExpand all lines: deployment/proxies.rst
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,21 @@ That's it! It's critical that you prevent traffic from all non-trusted sources.
7676
If you allow outside traffic, they could "spoof" their true IP address and
7777
other information.
7878

79+
Custom Headers When Using a Reverse Proxy
80+
-----------------------------------------
81+
82+
Some reverse proxies (like CloudFront with ``CloudFront-Forwarded-Proto``) may force you to use a custom header.
83+
For instance you have ``Custom-Forwarded-Proto`` instead of ``X-Forwarded-Proto``.
84+
85+
In this case, you'll need to set the header ``X-Forwarded-Proto`` with the value of
86+
``Custom-Forwarded-Proto`` early enough in your application, i.e. before handling the request::
87+
88+
// web/app.php
89+
90+
// ...
91+
$_SERVER['HEADER_X_FORWARDED_PROTO'] = $_SERVER['HEADER_CUSTOM_FORWARDED_PROTO'];
92+
// ...
93+
$response = $kernel->handle($request);
94+
7995
.. _`security groups`: http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html
96+
.. _`RFC 7239`: http://tools.ietf.org/html/rfc7239

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.