Skip to content

Commit ae6971a

Browse files
committed
Upgrade to Tomcat 8.0.30 and continue to use absolute redirects
Tomcat 8.0.30 has changed to using relative URIs in its redirects by default. To avoid any problems that this behaviour change may causes we override the default and configure Tomcat to continue to use absolute URIs. Closes spring-projectsgh-4715
1 parent b10b7a8 commit ae6971a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<thymeleaf-extras-conditionalcomments.version>2.1.1.RELEASE</thymeleaf-extras-conditionalcomments.version>
135135
<thymeleaf-layout-dialect.version>1.2.9</thymeleaf-layout-dialect.version>
136136
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
137-
<tomcat.version>8.0.28</tomcat.version>
137+
<tomcat.version>8.0.30</tomcat.version>
138138
<undertow.version>1.1.9.Final</undertow.version>
139139
<velocity.version>1.7</velocity.version>
140140
<velocity-tools.version>2.0</velocity-tools.version>

spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ protected void prepareContext(Host host, ServletContextInitializer[] initializer
167167
context.setParentClassLoader(
168168
this.resourceLoader != null ? this.resourceLoader.getClassLoader()
169169
: ClassUtils.getDefaultClassLoader());
170+
try {
171+
context.setUseRelativeRedirects(false);
172+
}
173+
catch (NoSuchMethodError ex) {
174+
// Tomcat is < 8.0.30. Continue
175+
}
170176
SkipPatternJarScanner.apply(context, this.tldSkip);
171177
WebappLoader loader = new WebappLoader(context.getParentClassLoader());
172178
loader.setLoaderClass(TomcatEmbeddedWebappClassLoader.class.getName());

0 commit comments

Comments
 (0)