I'm using spring-boot-starter-web
to create a war
app that is deployed on a standalone tomcat8
.
I have @EnableWebSecurity
to force basic-authentication
on each servlet request, and also to secure the gui.
But the main purpose is providing a webservice XML, that is mainly accessed programmatically. Thus, the clients send their GET
requests always with basic-auth.
Problem: tomcat will create a new session for each request! And as the clients connect programmatically to the xml servlets, the sessions are never logged-out. And also not reused as the next client request will again transmit the basic-auth.
So those sessions reside in the tomcat until timeout (eg default 30mins). And consume memory meanwhile.
Question: how can I tell tomcat or the spring-servlets that connections providing the basic-auth http header don't need to create a session? Just authenticate the user, send the response and forget about session infomration?