I'm having trouble figuring out why my sessions are not being saved on an AWS EC2 instance and I'm all out of potential solutions.
From what I understand, sessions are started / stored within one middleware class called, StartSession found within Illuminate\Session\Middleware\. This particular middleware class is terminable, meaning it has processes that run after the response is sent to the client. One of these processes is the save() method which actually writes all of the session contents to a session file found within storage/framework/sessions/ in the Laravel application root.
This is how it's supposed to work, but that it's intermittent on our application. Our app can generate CSRF tokens but the session files are not saved and nothing can be var_dumped.
Here is what I've tried:
- I've placed var_dump()s within the
StartSessionclass __construct() method, handle() method, and terminate() method but nothing prints out. Yet, this works on my local environment. - Thinking that it may be a configuration issue, I modified the app environment settings to match my local environment exactly, but still nothing prints out and nothing is saved.
- I've double-checked the permissions for the
sessionsdirectory and it is writable. Sometimes new sessions appear yet, nothing is var_dumped. - When I attempt to echo or var_dump in the
public\index.phpfile in different positions (beforehandle()and afterterminate()) this works as intended - My lost thought was that AWS stores a cached version of the server files and the changes have not populated, but I'm only running one EC2 instance, and this would not be the case as proven by tampering with
public\index.php
What could it be? What have I not tried yet? At this point, all I want to do is check and see how the application can run StartSession.
Thank you!
Aucun commentaire:
Enregistrer un commentaire