How to fix Invalid request (Unsupported SSL request)

I solved this later, just in case anyone has a similar problem in the future, I discovered the AppServiceProvider class had a register method where a security interception middleware was registered to force every HTTP request to HTTPS. So I wrote an if-else logic to allow this only on production since my localhost had no SSL certificate.

in app/providers/AppServiceProvider.php

look for the register() method, then implement the logic by checking whether the app is local or not. The isLocal() method checks your .env file for APP_ENV variable and returns true if it is local, so you reconfirm again that, that is set to local and be sure to clear any previous configuration cache.

//check that app is local
if ($this->app->isLocal()) {
//if local register your services you require for development
    $this->app->register('Barryvdh\Debugbar\ServiceProvider');
} else {
//else register your services you require for production
    $this->app['request']->server->set('HTTPS', true);
}

This is how I fixed my Invalid request (Unsupported SSL request)

NB: All these changes must be worked on from your project root directory

  1. Delete all files inside the bootstrap\cache folder (except the .gitignore file, that is if you have one)

  2. Delete the vendor folder

  3. Type composer install or composer update in command line terminal to install or update the necessary files and configurations back


  1. First make sure the APP_URL in the .env file is something like this: APP_URL=http://localhost or http://127.0.0.1:8000
  2. Change APP_ENV=production to APP_ENV=development
  3. Then run php artisan serve again

if above method doesn't work

Edit the /app/Providers/AppServiceProvider.php file: URL::forceScheme('https'); to URL::forceScheme('http');

and run the application again