Access requests forwarded to async results may won't work with Undertow . See Pull request #235591. Now I realized it is bad idea to change Undertow default options, but requests forwarded to async results which only work with defined bean UndertowDeploymentInfoCustomizer
may be unsuitable?(cause I don't need change any default options in Tomcat before, and it really like a problem in Undertow, see review )
@Bean
UndertowDeploymentInfoCustomizer forwardPathPreservation() {
return (deploymentInfo) -> deploymentInfo.setPreservePathOnForward(false);
}
How about store a forwarded request copy or forwarded request path or InvocableHandlerMethod
field to AsyncWebRequest
then use it in async thread work? I think change this won't breaking behaviour for those who are relying default options, and make async results work fine. How do you think?
Comment From: wilkinsona
Thanks for the link to the review comment on the pull request. Given the description of HttpServletRequest.getRequestURL
where it states that "if this request has been forwarded using RequestDispatcher.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
, the server path in the reconstructed URL must reflect the path used to obtain the RequestDispatcher, and not the server path specified by the client", I think we should change the default in Spring Boot and provide a configuration property so that it's easy to set it back. This may be a breaking change for some, so it'll have to be done in 2.4 rather than in a maintenance release. Thanks for bearing with us. I've opened https://github.com/spring-projects/spring-boot/issues/23619.
Just for the record, I don't think there's anything specific to async requests here. Any forward, irrespective of how it's handled, will be affected.