I have a Spring Boot application that I want to publish in Pantaris. It puts some information in the session scope and the request scope, for example to prepare a configuration whose visualization is updated in the website via AJAX. When I start the sandbox in Pantaris, the application doesn’t work anymore. It seems that the session and request scoped attributes are somehow lost.
It works perfectly fine when I run the application from the docker-compose file locally.
Is Pantaris somehow dropping session/request informations when forwarding the request to the app? Do I need to configure something additionally to make it work?
Is there any experience with Spring Boot applications in Pantaris?
I can’t answer it for spring boot, but it might be cause of we modify cookies/headers. Might be worth to check if you can connect the spring-session with the given headers
not sure what you mean. It doesn’t seem that Pantaris is having some session information. But I will investigate and see what Pantaris is removing to break session handling with Spring Boot.
when your application is hosted on PANTARIS, we provide session information on the request-headers. Check the link to the documenation in my previous answer for details: Documentation | PANTARIS
Sorry, but there is not a single mention of session information on that page. Everything is about application or instance, which I think of as “application instance”. So where should I find something about session information?
E.g. if you have an API running on PANTARIS, you get information about the requesting user (id, mail, names) within the incoming request.
E.g. if you have a Frontend running on PANTARIS, you can the similar information from a cookie.
It’s not meant to be a 1:1 replace for your spring session. You can build your sessions using this information (e.g. for an API store a session in-memory by indexing using the user-id). In common sessions are mostly used to identify the current user, which you don’t have to, as the platform passes the information to you depending on the context via headers or cookies.
If I understand the mechanics correctly, Spring Boot (and probably other Java based frameworks) identifies the session via a session cookie named “JSESSIONID”. That cookie seems to be dropped by Pantaris. And therefore there is actually no session handling in a Spring Boot application hosted in Pantaris.
I haven’t found a way how to tell Spring to use some other information for the session identification. The JSESSIONID cookie is AFAIK the default session identifier for Java based http session handling.
According to the first search result of my google-search spring boot has an alternative to cookies: Spring Session
Well, I am also able to use Google and found that myself. But that actually means I have to rewrite the application and change a lot of stuff, just because the JSESSIONID cookie is not sent. But ok, I will change my application to handle such stuff somehow to get the demonstrator working with an application scoped mapping.