0

I'm using Laravel Collective Form and running Laravel 5.6. There is no error in local MAMP. However, after I setup in Production (Ubuntu) on AWS, the form was not working. When I submitted the form, it always went to "The page has expired due to inactivity".

Before I asked, I've already tried the other suggested methods, but still didn't work.

Clear Cache

php artisan cache:clear
php artisan config:clear 
php artisan route:clear 
php artisan view:clear

Set Directory Permissions

sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache

Session Cookie Domain

'domain' => env('SESSION_DOMAIN', null),

Session Secure Value

'secure' => env('SESSION_SECURE_COOKIE', false),

What else am I missing?

Update: looks like it's a CSRF token mismatch issue.

trojan
  • 33
  • 1
  • 9

1 Answers1

0

Inside the route file, add the followings:

Route::get('csrf', function() {
    return Session::token();
});

Someone told me that this is the issue with current session token and provide the above solution. But, I am not sure why the session token is different from the CSRF token on the form.

trojan
  • 33
  • 1
  • 9