-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
I have a page that makes two ajax requests fired by the same event, so they will be firing pretty much synchronously.
This causes Laravel 4.1 some problems. It seems that each request by the ajax calls tries to rewrite the session, ( I'm using the files driver ) and the outcome is that a new session is written, leaving me with two sessions files, that latest one being the one used. This latest one has no session data, so my user is logged out.
From observing the storage folder it seems that each http request deletes the current session and then rewrites a new session file. This is fine as long as there isn't another http request before the session is rewritten. If there is another request in quick succession ( such as with two ajax calls from the same page fired on the same event ), the session is blown. I'm assuming this is because the 2nd call looks for session data to persist, and find none.
I've also tried the memcached and cookie driver, and I get the same issue as with the files driver. I have also tried using 'return response::json(...)' , as I found as a suggested solution elsewhere on forums, but no joy.
Any suggestions? I have failed to find any decent solution to this. Surely there must be a way for Laravel to handle a quick succession of requests and persist the session?