Skip to content

add support for custom headers when using a proxy #12117

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
Aug 16, 2019
Merged
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
17 changes: 17 additions & 0 deletions deployment/proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,20 @@ other information.

.. _`security groups`: http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html
.. _`RFC 7239`: http://tools.ietf.org/html/rfc7239

Custom Headers When Using a Reverse Proxy
-----------------------------------------

Some reverse proxies (like CloudFront with ``CloudFront-Forwarded-Proto``) may force you to use a custom header.
For instance you have ``Custom-Forwarded-Proto`` instead of ``X-Forwarded-Proto``.

In this case, you'll need to set the header ``X-Forwarded-Proto`` with the value of
``Custom-Forwarded-Proto`` early enough in your application, i.e. before handling the request::

// web/app.php

// ...
$_SERVER['HEADER_X_FORWARDED_PROTO'] = $_SERVER['HEADER_CUSTOM_FORWARDED_PROTO'];
// ...
$response = $kernel->handle($request);