Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Saeedsikandar's avatar

419 | Page Expire exception

I add @csrf token in all my forms but I was intergrating twill cms into it and it was working fine but suddenly I face this error

snapshot

I search through internet find alot of stuff tried many of them but didn't work for me like I set file permission to code grepper example as csrf verfication depends on sessions I double check sessions are working or not but they working when remove csrf protection on

VerfifyCsrfToken middleware by doing this

<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array<int, string>
     */
    protected $except = [
        "/*"
    ];
}

but forms submission has been then session is not working what's wrong with this I didn't understand ?

0 likes
11 replies
Snapey's avatar

Are you able to login (to check sessions are working) ?

Do you receive a cookie?

Snapey's avatar

@Saeedsikandar If you are using apache then you might have an issue where stray content before the opening php tag on a page is being sent before cookies. This then prevents cookies being sent, and then sessions fail (and csrf as a consequence of no session).

Apache?

Saeedsikandar's avatar

@Snapey I test another form submission but not on valet test domain I ran it into laravel default server

php artisan serve

and it working fine is there something wrong with my valet ? I running this project in Ubuntu 22.04.1 LTS

Please or to participate in this conversation.