Skip to content

fix code example #10421

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
Oct 2, 2018
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
30 changes: 16 additions & 14 deletions deployment/proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,29 @@ these (see ":doc:`/components/http_foundation/trusting_proxies`").

The code for doing this will need to live in your front controller (e.g. ``web/app.php``).

My Reverse Proxy Does not Provide All the Standards Headers
-----------------------------------------------------------
.. _my-reverse-proxy-does-not-provide-all-the-standards-headers:

My Reverse Proxy Does not Provide All the Standard Headers
----------------------------------------------------------

AWS Elastic Load Balancing for example does not provide the ``X-Forwarded-Host``
and ``X-Forwarded`` HTTP headers, so you must make the following changes in the
front controller::
front controller:

.. code-block:: diff
.. code-block:: diff

// web/app.php
// web/app.php

// ...
$request = Request::createFromGlobals();
// be very careful with the next line; see "But what if the IP of my Reverse Proxy Changes Constantly!"
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
// the next line is needed because AWS ELB doesn't send X-Forwarded-Host
+ Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);
// the next line is needed because AWS ELB doesn't use RFC 7239
+ Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
// ...
$request = Request::createFromGlobals();
// be very careful with the next line; see "But what if the IP of my Reverse Proxy Changes Constantly!"
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
// the next line is needed because AWS ELB doesn't send X-Forwarded-Host
+ Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);
// the next line is needed because AWS ELB doesn't use RFC 7239
+ Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);

// ...
// ...

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