Skip to content

Commit 18c3b63

Browse files
committed
Fix dated Javadoc in MvcUriComponentsBuilder
related to forwarded headers Closes gh-34615
1 parent 34c69bf commit 18c3b63

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

spring-web/src/main/java/org/springframework/web/cors/CorsConfiguration.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -297,14 +297,7 @@ private static void parseCommaDelimitedOrigin(String rawValue, Consumer<String>
297297
* allowCredentials} is set to {@code true}, that combination is handled
298298
* by copying the method specified in the CORS preflight request.
299299
* <p>If not set, only {@code "GET"} and {@code "HEAD"} are allowed.
300-
* <p>By default this is not set.
301-
* <p><strong>Note:</strong> CORS checks use values from "Forwarded"
302-
* (<a href="https://tools.ietf.org/html/rfc7239">RFC 7239</a>),
303-
* "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers,
304-
* if present, in order to reflect the client-originated address.
305-
* Consider using the {@code ForwardedHeaderFilter} in order to choose from a
306-
* central place whether to extract and use, or to discard such headers.
307-
* See the Spring Framework reference for more on this filter.
300+
* <p>By default, this is not set.
308301
*/
309302
public void setAllowedMethods(@Nullable List<String> allowedMethods) {
310303
this.allowedMethods = (allowedMethods != null ? new ArrayList<>(allowedMethods) : null);
@@ -456,7 +449,7 @@ public void addExposedHeader(String exposedHeader) {
456449
* level of trust with the configured domains and also increases the surface
457450
* attack of the web application by exposing sensitive user-specific
458451
* information such as cookies and CSRF tokens.
459-
* <p>By default this is not set (i.e. user credentials are not supported).
452+
* <p>By default, this is not set (i.e. user credentials are not supported).
460453
*/
461454
public void setAllowCredentials(@Nullable Boolean allowCredentials) {
462455
this.allowCredentials = allowCredentials;
@@ -480,7 +473,7 @@ public Boolean getAllowCredentials() {
480473
* <p>Setting this property has an impact on how {@link #setAllowedOrigins(List)
481474
* origins} and {@link #setAllowedOriginPatterns(List) originPatterns} are processed,
482475
* see related API documentation for more details.
483-
* <p>By default this is not set (i.e. private network access is not supported).
476+
* <p>By default, this is not set (i.e. private network access is not supported).
484477
* @since 5.3.32
485478
* @see <a href="https://wicg.github.io/private-network-access/">Private network access specifications</a>
486479
*/

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -84,13 +84,12 @@
8484
* {@link #relativeTo(org.springframework.web.util.UriComponentsBuilder)}.
8585
* </ul>
8686
*
87-
* <p><strong>Note:</strong> This class uses values from "Forwarded"
88-
* (<a href="https://tools.ietf.org/html/rfc7239">RFC 7239</a>),
89-
* "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers,
90-
* if present, in order to reflect the client-originated protocol and address.
91-
* Consider using the {@code ForwardedHeaderFilter} in order to choose from a
92-
* central place whether to extract and use, or to discard such headers.
93-
* See the Spring Framework reference for more on this filter.
87+
* <p><strong>Note:</strong> As of 5.1, methods in this class do not extract
88+
* {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
89+
* client-originated address. Please, use
90+
* {@link org.springframework.web.filter.ForwardedHeaderFilter
91+
* ForwardedHeaderFilter}, or similar from the underlying server, to extract
92+
* and use such headers, or to discard them.
9493
*
9594
* @author Oliver Gierke
9695
* @author Rossen Stoyanchev

0 commit comments

Comments
 (0)