Skip to content

Commit 43ed824

Browse files
committed
Reinstate Tomcat’s old default behaviour for context root redirects
Prior to Tomcat 8.0.30, its default behaviour was for the mapper to redirect a request for context-root to context-root/. This redirection was switched off by default in 8.0.30 by default. This has proven to be problematic and Tomcat 8.0.31 will reinstate the old default. While we are waiting for Tomcat 8.0.31 to be released, this commit explicitly sets the default back to what it was in 8.0.29 and earlier and what it will be in 8.0.31. Closes gh-4937
1 parent 2f2bba4 commit 43ed824

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 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.
@@ -169,6 +169,7 @@ protected void prepareContext(Host host, ServletContextInitializer[] initializer
169169
: ClassUtils.getDefaultClassLoader());
170170
try {
171171
context.setUseRelativeRedirects(false);
172+
context.setMapperContextRootRedirectEnabled(true);
172173
}
173174
catch (NoSuchMethodError ex) {
174175
// Tomcat is < 8.0.30. Continue

0 commit comments

Comments
 (0)