Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 Asyncronous AJAX requests cause session problems

I am using Laravel 5 ("laravel/framework" version is " v5.1.16", Homestead Ubuntu), with session driver = 'file'.

I noticed that if a number of async AJAX requests (jQuery) are fired eg. in autocomplete search form field then the session variables are gone.

This happens, only with async AJAX requests, when async option is set to false this problem no longer exists.

Also, when session driver is set to 'cookie' and async set to true there is a new cookie created on each AJAX request, so with 10 requests there will be 10 laravel cookies etc.

Any suggestions? I have failed to find any decent cause or solution to this, except not using async requests.

Related issues, which seems to be fixed.

https://github.com/laravel/framework/issues/7549

https://github.com/laravel/framework/issues/5416

like image 683
dth Avatar asked Nov 09 '22 04:11

dth


1 Answers

For the sake of having an answer to this question and as "The Shift Exchange" already explained in his comment...

This is a known issue - with no solution: github.com/laravel/framework/issues/8172 - the problem is no one is able to provide a replicatable situation - it seems to be random, rare and no obvious cause.

like image 55
Markus Safar Avatar answered Nov 14 '22 23:11

Markus Safar