My problem is the following:
I have a page which runs a series of AJAX calls e.g.
$.ajax({ url: "/user/post1" });
$.ajax({ url: "/user/post2" });
$.ajax({ url: "/user/post3" });
...
$.ajax({ url: "/user/postN" });
(I've determined the ids beforehand)
I've also got:
$.ajax({ url: "/user/modifysessiondata" });
Now the problem is that I need to start the session in each and every request (to get the current user) and in addition "/user/modifysessiondata" also needs to modify session data.
However I've noticed that if I just execute all AJAX requests at once it's possible that if a /user/postX
request starts before /user/modifysessiondata
request and ends after that then it will save the session data as it was when the request was called and therefore will overwrite the session data that was set by the 2nd call.
My question is:
Is it possible to flag the session started in a specific request as "Read only"? Would I need to create a new custom StartSession
middleware for this?
Am I just doing something completely ridiculous?
Note: To clarify I'm talking about the Laravel session. I am using a redis backed session storage.
via apokryfos