I would like to disable the HttpOnly sessions, which in my opinion are the default for Spring Boot. How to disable HttpOnly on Spring boot?
I currently have code, for example:
@RequestMapping(value = "/stuff", method = GET) public @ResponseBody myObject doStuff(HttpSession session) { session.setAttribute("foo", "bar"); return new MyObject(); }
This returns the response header when calling HTTP:
Set-Cookie: JSESSIONID=D14846D9767B6404F1FB4B013AB66FB3; Path=/; HttpOnly
Check out the HttpOnly flag. I would like to disable this. How to do it?
Side note: Yes, I know that httpOnly is a security feature, and by disabling it, javascript can access my cookie, i.e. XSS.
In addition, I have no other configuration than the standard one.
@ComponentScan @EnableAutoConfiguration public class WebApplication { public static void main(String[] args) { SpringApplication app = new SpringApplication(WebApplication.class); app.run(args); } }
Nick humrich
source share