412 expires

Here's the complete corrected AppServiceProvider.php that will resolve your 419 error:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Schema;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // Force HTTPS in production
        if ($this->app->environment('production')) {
            URL::forceScheme('https');
        }

        // Set default string length for MySQL
        Schema::defaultStringLength(191);
        
        // REMOVED the configureSecureCookies() method entirely
        // Laravel's built-in session handling will now work correctly
    }
}

 

Required .env Settings:

APP_URL=https://admin.excellentresumes.co.in
SESSION_DOMAIN=.excellentresumes.co.in
SESSION_SECURE_COOKIE=true
SESSION_HTTP_ONLY=true
SESSION_SAME_SITE=lax

web.php

Route::get('/test', function() {
    return response()->json([
        'session_id' => session()->getId(),
        'csrf_token' => csrf_token()
    ]);
});

  1. Run these commands:

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

Did you find this article useful?

  • laravel dashboard setup

    login:1 Mixed Content: The page at 'https://excellentresumes.co.in/admin/login' was loaded over HTTP...