Skip to content

Commit 12d0b82

Browse files
committed
minor #4113 tweaks to the new reverse proxy/load balancer chapter (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- tweaks to the new reverse proxy/load balancer chapter | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | Commits ------- bbc2f11 fix code block 6943da8 fix a headline 12840b1 improve linking between proxy config sections
2 parents 4cce133 + bbc2f11 commit 12d0b82

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

book/http_cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The caching kernel will immediately act as a reverse proxy - caching responses
163163
from your application and returning them to the client.
164164

165165
Now that you're using a "proxy", you'll need to configure ``127.0.0.1`` under
166-
the ``trusted_proxies`` configuration (see :ref:`reference <reference-framework-trusted-proxies>`).
166+
the ``trusted_proxies`` configuration (see :ref:`the reference <reference-framework-trusted-proxies>`).
167167
Without this, the client's IP address and a few other things won't report correctly.
168168

169169
.. tip::

cookbook/request/load_balancer_reverse_proxy.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
How to Configure Symfony to Work behind a Load Balancer or Reverse Proxy
2-
========================================================================
1+
How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy
2+
==========================================================================
33

44
When you deploy your application, you may be behind a load balancer (e.g.
55
an AWS Elastic Load Balancer) or a reverse proxy (e.g. Varnish for
@@ -60,7 +60,8 @@ and which reverse proxy IP addresses will be doing this type of thing:
6060
6161
In this example, you're saying that your reverse proxy (or proxies) has
6262
the IP address ``192.0.0.1`` or matches the range of IP addresses that use
63-
the CIDR notation ``10.0.0.0/8``. For more details, see :ref:`reference-framework-trusted-proxies`.
63+
the CIDR notation ``10.0.0.0/8``. For more details, see the
64+
:ref:`framework.trusted_proxies <reference-framework-trusted-proxies>` option.
6465

6566
That's it! Symfony will now look for the correct ``X-Forwarded-*`` headers
6667
to get information like the client's IP address, host, port and whether or
@@ -80,13 +81,13 @@ In this case, you'll need to - *very carefully* - trust *all* proxies.
8081
proxies, configure Symfony to *always* trust incoming request. This is
8182
done inside of your front controller::
8283

83-
// web/app.php
84-
// ...
84+
// web/app.php
8585

86-
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
86+
// ...
87+
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
8788

88-
$response = $kernel->handle($request);
89-
// ...
89+
$response = $kernel->handle($request);
90+
// ...
9091

9192
That's it! It's critical that you prevent traffic from all non-trusted sources.
9293
If you allow outside traffic, they could "spoof" their true IP address and
@@ -97,7 +98,7 @@ My Reverse Proxy Uses Non-Standard (not X-Forwarded) Headers
9798

9899
Most reverse proxies store information on specific ``X-Forwarded-*`` headers.
99100
But if your reverse proxy uses non-standard header names, you can configure
100-
these (:doc:`see reference </components/http_foundation/trusting_proxies>`.
101+
these (see ":doc:`/components/http_foundation/trusting_proxies`").
101102
The code for doing this will need to live in your front controller (e.g. ``web/app.php``).
102103

103104
.. _`security groups`: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-elb-security-groups.html

0 commit comments

Comments
 (0)