File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
spring-web/src/main/java/org/springframework/web Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 56
56
* <li>{@link HttpServletResponse#sendRedirect(String) sendRedirect(String)}.
57
57
* </ul>
58
58
*
59
- * <p>This filter can also be used in a {@link #setRemoveOnly removeOnly} mode
60
- * where "Forwarded" and "X-Forwarded-*" headers are eliminated, and not used.
59
+ * <p>There are security considerations for forwarded headers since an application
60
+ * cannot know if the headers were added by a proxy, as intended, or by a malicious
61
+ * client. This is why a proxy at the boundary of trust should be configured to
62
+ * remove untrusted Forwarded headers that come from the outside.
63
+ *
64
+ * <p>You can also configure the ForwardedHeaderFilter with {@link #setRemoveOnly removeOnly},
65
+ * in which case it removes but does not use the headers.
61
66
*
62
67
* @author Rossen Stoyanchev
63
68
* @author Eddú Meléndez
Original file line number Diff line number Diff line change 36
36
* the request URI (i.e. {@link ServerHttpRequest#getURI()}) so it reflects
37
37
* the client-originated protocol and address.
38
38
*
39
- * <p>Alternatively if {@link #setRemoveOnly removeOnly} is set to "true",
40
- * then "Forwarded" and "X-Forwarded-*" headers are only removed, and not used.
41
- *
42
39
* <p>An instance of this class is typically declared as a bean with the name
43
40
* "forwardedHeaderTransformer" and detected by
44
41
* {@link WebHttpHandlerBuilder#applicationContext(ApplicationContext)}, or it
45
42
* can also be registered directly via
46
43
* {@link WebHttpHandlerBuilder#forwardedHeaderTransformer(ForwardedHeaderTransformer)}.
47
44
*
45
+ * <p>There are security considerations for forwarded headers since an application
46
+ * cannot know if the headers were added by a proxy, as intended, or by a malicious
47
+ * client. This is why a proxy at the boundary of trust should be configured to
48
+ * remove untrusted Forwarded headers that come from the outside.
49
+ *
50
+ * <p>You can also configure the ForwardedHeaderFilter with {@link #setRemoveOnly removeOnly},
51
+ * in which case it removes but does not use the headers.
52
+ *
48
53
* @author Rossen Stoyanchev
49
54
* @since 5.1
50
55
* @see <a href="https://tools.ietf.org/html/rfc7239">https://tools.ietf.org/html/rfc7239</a>
You can’t perform that action at this time.
0 commit comments