spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.91k stars 40.62k forks source link

Support Tomcat 11.0 #42730

Open sephiroth-j opened 4 hours ago

sephiroth-j commented 4 hours ago

Tomcat 11.0.0 was released last week and it would be nice if Spring Boot 3.4 would support the new version. This requires at least changing TomcatWebServerFactoryCustomizer.customizeRejectIllegalHeader as it uses a previously deprecated method setRejectIllegalHeader which was removed with Tomcat 11.0.

https://github.com/spring-projects/spring-boot/blob/35a3ff9548808ba94990490be2ac374f4619282c/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java#L227

Catching a NoSuchMethodError would be sufficient and is something that is already done in customizeRemoteIpValve.

https://github.com/spring-projects/spring-boot/blob/35a3ff9548808ba94990490be2ac374f4619282c/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java#L251-L257

wilkinsona commented 3 hours ago

With 3.4.0-RC1 only a week away, I'm afraid it's too late for us to support Tomcat 11 in Boot 3.4. Furthermore, Tomcat 11 is a Servlet 6.1 (Jakarta EE 11) compatibile container and exceeds our baseline. We may consider supporting Tomcat 11 in Spring Boot 3.5 alongside Tomcat 10 (which would likely remain the default) but it may also have to wait for Spring Boot 4.0 in a year's time.

In the meantime, this issue has led to me noticing that we should have removed support for configuring rejectIllegalHeader as it has been deprecated for some time now. I've opened https://github.com/spring-projects/spring-boot/issues/42731 to do that. This may get things working with Tomcat 11 but please note that if it works it still wouldn't be supported and you would be using Tomcat 11 at your own risk with no guarantee that we'll make further changes in 3.4.x to address any other problems that you may encounter.

sephiroth-j commented 3 hours ago

I've opened #42731 to do that.

Thanks, that should be enough for now. Then we can test whether the new version works without being officially supported.