1
@Override
public void doFilter
    (
        ServletRequest request, 
        ServletResponse response, 
        FilterChain chain
    ) throws IOException, ServletException {

    HttpServletResponse resp = (HttpServletResponse)response;
    resp.setHeader("Set-Cookie", "local=de;HttpOnly; SameSite=None;);
    chain.doFilter(request, response);
}

when i set it resp.setHeader("Set-Cookie", "local=de;HttpOnly; SameSite=None;) -> chrome says "recieved a cookie with sameSite ="None" but not secure" when i add secure secure flag this way resp.setHeader("Set-Cookie", "local=de;HttpOnly; SameSite=None;Secure) -> chrome says "recieved cookie without SameSite attribute"

additonal information: im using spring boot with spring security runnig on a different server using ngrok tunnel . and testing with angular on another server on(localhost:4200) making htp calls. please help me fix this. i'm stuck since two days. when i add secure=true this way server.servlet.session.cookie.secure=true . chrome says samesite attribute not found

the complete code can be found here: github.com/bharatvarmagit/BookStore in userauth branch

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
Venkata N
  • 11
  • 2

0 Answers0