Commit 43ed824f authored by Andy Wilkinson's avatar Andy Wilkinson

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
parent 2f2bba4d
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -169,6 +169,7 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -169,6 +169,7 @@ public class TomcatEmbeddedServletContainerFactory
: ClassUtils.getDefaultClassLoader()); : ClassUtils.getDefaultClassLoader());
try { try {
context.setUseRelativeRedirects(false); context.setUseRelativeRedirects(false);
context.setMapperContextRootRedirectEnabled(true);
} }
catch (NoSuchMethodError ex) { catch (NoSuchMethodError ex) {
// Tomcat is < 8.0.30. Continue // Tomcat is < 8.0.30. Continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment