diff --git a/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerProperties.java b/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerProperties.java index 1ca76eee73e..3b9ff9e05aa 100644 --- a/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerProperties.java +++ b/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerProperties.java @@ -56,7 +56,6 @@ import org.springframework.util.unit.DataSize; * @author Florian Storz * @author Michael Weidmann * @author Lasse Wulff - * @author Tiziano Basile * @since 4.0.0 */ @ConfigurationProperties("server.tomcat") @@ -104,7 +103,7 @@ public class TomcatServerProperties { /** * Whether HTTP 1.1 and later location headers generated by a call to sendRedirect - * will use relative or absolute redirects. Has no effect on a reactive web server. + * will use relative or absolute redirects. */ private boolean useRelativeRedirects = true; diff --git a/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/servlet/TomcatServletWebServerFactoryCustomizer.java b/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/servlet/TomcatServletWebServerFactoryCustomizer.java index b780a80a210..7af0d96e6d3 100644 --- a/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/servlet/TomcatServletWebServerFactoryCustomizer.java +++ b/module/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure/servlet/TomcatServletWebServerFactoryCustomizer.java @@ -29,7 +29,6 @@ import org.springframework.util.ObjectUtils; * * @author Brian Clozel * @author Phillip Webb - * @author Tiziano Basile */ class TomcatServletWebServerFactoryCustomizer implements WebServerFactoryCustomizer, Ordered { diff --git a/module/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerPropertiesTests.java b/module/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerPropertiesTests.java index 00d5fddb4f0..c7eee4a6fe4 100644 --- a/module/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerPropertiesTests.java +++ b/module/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/autoconfigure/TomcatServerPropertiesTests.java @@ -74,7 +74,7 @@ class TomcatServerPropertiesTests { map.put("server.tomcat.background-processor-delay", "10"); map.put("server.tomcat.relaxed-path-chars", "|,<"); map.put("server.tomcat.relaxed-query-chars", "^ , | "); - map.put("server.tomcat.use-relative-redirects", "true"); + map.put("server.tomcat.use-relative-redirects", "false"); bind(map); Accesslog accesslog = this.properties.getAccesslog(); assertThat(accesslog.getConditionIf()).isEqualTo("foo"); @@ -96,7 +96,7 @@ class TomcatServerPropertiesTests { assertThat(this.properties.getBackgroundProcessorDelay()).hasSeconds(10); assertThat(this.properties.getRelaxedPathChars()).containsExactly('|', '<'); assertThat(this.properties.getRelaxedQueryChars()).containsExactly('^', '|'); - assertThat(this.properties.isUseRelativeRedirects()).isTrue(); + assertThat(this.properties.isUseRelativeRedirects()).isFalse(); } @Test @@ -240,6 +240,11 @@ class TomcatServerPropertiesTests { assertThat(this.properties.isUseRelativeRedirects()).isTrue(); } + @Test + void tomcatUseRelativeRedirectsMatchesDefault() { + assertThat(this.properties.isUseRelativeRedirects()).isEqualTo(new StandardContext().getUseRelativeRedirects()); + } + @Test void tomcatMaxKeepAliveRequestsDefault() throws Exception { AbstractEndpoint endpoint = (AbstractEndpoint) ReflectionTestUtils.getField(getDefaultProtocol(),