@@ -7,9 +7,11 @@ an AWS Elastic Load Balancer) or a reverse proxy (e.g. Varnish for
7
7
8
8
For the most part, this doesn't cause any problems with Symfony. But, when
9
9
a request passes through a proxy, certain request information is sent using
10
- special ``X-Forwarded-* `` headers. For example, instead of reading the ``REMOTE_ADDR ``
11
- header (which will now be the IP address of your reverse proxy), the user's
12
- true IP will be stored in an ``X-Forwarded-For `` header.
10
+ either the standard ``Forwarded `` header or non standard special ``X-Forwarded-* ``
11
+ headers. For example, instead of reading the ``REMOTE_ADDR `` header (which
12
+ will now be the IP address of your reverse proxy), the user's true IP will be
13
+ stored in a standard ``Forwarded: for="..." `` header or a non standard
14
+ ``X-Forwarded-For `` header.
13
15
14
16
If you don't configure Symfony to look for these headers, you'll get incorrect
15
17
information about the client's IP address, whether or not the client is connecting
@@ -57,9 +59,9 @@ the IP address ``192.0.0.1`` or matches the range of IP addresses that use
57
59
the CIDR notation ``10.0.0.0/8 ``. For more details, see the
58
60
:ref: `framework.trusted_proxies <reference-framework-trusted-proxies >` option.
59
61
60
- That's it! Symfony will now look for the correct `` X-Forwarded-* `` headers
61
- to get information like the client's IP address, host, port and whether or
62
- not the request is using HTTPS.
62
+ That's it! Symfony will now look for the correct headers to get information
63
+ like the client's IP address, host, port and whether or not the request is
64
+ using HTTPS.
63
65
64
66
But what if the IP of my Reverse Proxy Changes Constantly!
65
67
----------------------------------------------------------
@@ -90,9 +92,15 @@ other information.
90
92
My Reverse Proxy Uses Non-Standard (not X-Forwarded) Headers
91
93
------------------------------------------------------------
92
94
93
- Most reverse proxies store information on specific ``X-Forwarded-* `` headers.
94
- But if your reverse proxy uses non-standard header names, you can configure
95
+ Although `rfc7239 `_ recently defined a standard ``Forwarded `` header to disclose
96
+ all proxy information, most reverse proxies stores information on non standard
97
+ ``X-Forwarded-* `` headers.
98
+ But if your reverse proxy uses other non-standard header names, you can configure
95
99
these (see ":doc: `/components/http_foundation/trusting_proxies `").
96
100
The code for doing this will need to live in your front controller (e.g. ``web/app.php ``).
97
101
102
+ .. versionadded :: 2.6
103
+ ``Forwarded `` header support was introduced in Symfony 2.6
104
+
98
105
.. _`security groups` : http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-elb-security-groups.html
106
+ .. _`rfc7239` : http://tools.ietf.org/html/rfc7239
0 commit comments