Skip to content

Commit 7c82782

Browse files
committed
fix code example
1 parent 6577405 commit 7c82782

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

deployment/proxies.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,29 @@ 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-
My Reverse Proxy Does not Provide All the Standards Headers
141-
-----------------------------------------------------------
140+
.. _my-reverse-proxy-does-not-provide-all-the-standards-headers:
141+
142+
My Reverse Proxy Does not Provide All the Standard Headers
143+
----------------------------------------------------------
142144

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

147-
.. code-block:: diff
149+
.. code-block:: diff
148150
149-
// web/app.php
151+
// web/app.php
150152
151-
// ...
152-
$request = Request::createFromGlobals();
153-
// be very careful with the next line; see "But what if the IP of my Reverse Proxy Changes Constantly!"
154-
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
155-
// the next line is needed because AWS ELB doesn't send X-Forwarded-Host
156-
+ Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);
157-
// the next line is needed because AWS ELB doesn't use RFC 7239
158-
+ Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
153+
// ...
154+
$request = Request::createFromGlobals();
155+
// be very careful with the next line; see "But what if the IP of my Reverse Proxy Changes Constantly!"
156+
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
157+
// the next line is needed because AWS ELB doesn't send X-Forwarded-Host
158+
+ Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null);
159+
// the next line is needed because AWS ELB doesn't use RFC 7239
160+
+ Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
159161
160-
// ...
162+
// ...
161163
162164
.. _`security groups`: http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-groups.html
163165
.. _`RFC 7239`: http://tools.ietf.org/html/rfc7239

0 commit comments

Comments
 (0)