File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,23 @@ and what headers your reverse proxy uses to send information:
88
88
to trust all "X-Forwarded-" headers, but that constant is deprecated since
89
89
Symfony 5.2 in favor of the individual ``HEADER_X_FORWARDED_* `` constants.
90
90
91
+ .. tip ::
92
+
93
+ In applications using :ref: `Symfony Flex <symfony-flex >` you can set the
94
+ ``TRUSTED_PROXIES `` env var:
95
+
96
+ .. code-block :: bash
97
+
98
+ # .env
99
+ TRUSTED_PROXIES=127.0.0.1
100
+
101
+ .. code-block :: yaml
102
+
103
+ # config/packages/framework.yaml
104
+ framework :
105
+ # ...
106
+ trusted_proxies : ' %env(TRUSTED_PROXIES)%'
107
+
91
108
.. caution ::
92
109
93
110
Enabling the ``Request::HEADER_X_FORWARDED_HOST `` option exposes the
@@ -136,23 +153,6 @@ That's it! It's critical that you prevent traffic from all non-trusted sources.
136
153
If you allow outside traffic, they could "spoof" their true IP address and
137
154
other information.
138
155
139
- .. tip ::
140
-
141
- In applications using :ref: `Symfony Flex <symfony-flex >` you can set the
142
- ``TRUSTED_PROXIES `` env var:
143
-
144
- .. code-block :: bash
145
-
146
- # .env
147
- TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR
148
-
149
- .. code-block :: yaml
150
-
151
- # config/packages/framework.yaml
152
- framework :
153
- # ...
154
- trusted_proxies : ' %env(TRUSTED_PROXIES)%'
155
-
156
156
If you are also using a reverse proxy on top of your load balancer (e.g.
157
157
`CloudFront `_), calling ``$request->server->get('REMOTE_ADDR') `` won't be
158
158
enough, as it will only trust the node sitting directly above your application
You can’t perform that action at this time.
0 commit comments