Context:我正在JDK11/TOMCAT9上托管的Spring应用程序5.3.x迁移到JDK21/TOMCAT11
举办的Spring 6.1.x 我的问题是,在迁移之后,当我在Http
中请求过滤器时,返回true。 当然,在迁移之前,一切都按预期工作。
request.isSecure()
这会导致设置为jsessionId cookietosecure防止浏览器以所有进一步的要求将其发送回去,因为我正在http.
中访问该应用程序。
任何想法都可能导致这个问题吗?
谢谢
tomcat的配置(例如,对于tomcat9
@WebFilter({"/xxx"})
public class MyFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
assert "http".equals(request.getScheme()); // it passes
assert !request.isSecure(); // it fails
// create the session here, it will set the JSESSIONID cookie
request.getSession(true);
chain.doFilter(request, response);
}
}