Skip to content

Commit 8e57517

Browse files
bruno-dsjaviereguiluz
authored andcommitted
how to handle AWS partial reverse proxy headers
1 parent ba09b10 commit 8e57517

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

deployment/proxies.rst

+18
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,23 @@ these (see ":doc:`/components/http_foundation/trusting_proxies`").
137137

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

140+
141+
My Reverse Proxy do not provide all the standards headers
142+
---------------------------------------------------------
143+
For example, as AWS Elastic Load Balancing provide standard header but no X-Forwarded-Host and X-Forwarded, you should use this configuration your front controller::
144+
.. code-block:: diff
145+
146+
// web/app.php
147+
148+
// ...
149+
$request = Request::createFromGlobals();
150+
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR'))); //be very careful with this line, see the above chapter "But what if the IP of my Reverse Proxy Changes Constantly!"
151+
+
152+
+ Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);// AWS ELB doesn't send X-Forwarded-Host
153+
+ Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);// AWS ELB doesn't use RFC 7239
154+
155+
// ...
156+
157+
140158
.. _`security groups`: http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html
141159
.. _`RFC 7239`: http://tools.ietf.org/html/rfc7239

0 commit comments

Comments
 (0)