I have an issue where I uploaded my Laravel 11 project to InfinityFree hosting and used Backpack to create a dashboard for managing my website. However, when I navigate to the admin panel link, and after successfully logging in, I try to view the data stored in the database, but I encounter a 419 Page Expired error.
I have tried many solutions without success. Can anyone help me resolve this issue?
Note: I also tried disabling CSRF verification, but that did not work either.
disabling CSRF verification.
I tried searching for solutions online and implementing suggestions.
I have checked Laravel’s and Backpack’s configurations, session settings, or routes.
I expected the 419 error to stop appearing.
2
Answers
It seems like this could be a session-related issue. How is your session configured in the .env file? If the session driver is set to "file", make sure the correct permissions are applied to the storage directory. You can set them using the following command:
Also, ensure the correct owner and group are assigned to the directory.
For Backpack, it’s crucial to have the APP_URL setting in your .env file configured correctly. Verify that it matches the URL you use to access your application.
After making these adjustments, clear and optimize your application’s cache by running the following commands:
If the issue persists, check the Laravel error logs (storage/logs/laravel.log) or your server’s logs for more details.
Cheers!
This happens because the
APP_URL
in the.env
file is not correctly set.Make sure the
APP_URL
in your .env file is correctly pointing to the URL you use to access your application in the browser, for examplehttp://something.test
If you are using
php artisan serve
to serve your application inhttp://127.0.0.1:8000
, that’s what you need to write inAPP_URL
.If you are using
https
, make sure you write it down in app url.Let me know if that solves the issue for you.