Servletrequest.issecure () == true, но "http" .equals (servletrequest.getscheme ())JAVA

Программисты JAVA общаются здесь
Anonymous
Servletrequest.issecure () == true, но "http" .equals (servletrequest.getscheme ())

Сообщение Anonymous »

Контекст: я перемещаю весеннее приложение 5.3.x, размещенное на JDK11/Tomcat9 в Spring 6.1.x, размещенную на JDK21/Tomcat11
Моя проблема заключается в том, что после миграции. Ожидается. < /p>

Код: Выделить всё

@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);
}

}
Это приводит к тому, что файл cookie jsessionId устанавливает secure , предотвращая его отправку обратно по всем дальнейшим запросам, потому что я получаю доступ к приложению в http .


Подробнее здесь: https://stackoverflow.com/questions/795 ... -getscheme

Вернуться в «JAVA»