Simple Way To HTTPS All Laravel Routes

I thought this would be a quick search on the internet to make all routes HTTPS in Laravel, but came across a lot of solutions and a lot which seemed like to much code/work for something that i thought would be a quick fix and some of the solutions just did not work for me.

After a while of searching the simplest way i found was to edit:

C:\VolledServer\volled\app\Providers\AppServiceProvider  

and at the top of AppServiceProvider file add:

use Illuminate\Support\Facades\URL;  

and then under boot add the below.

public function boot()  
    {
     URL::forceScheme('https');
    }

That's how simple it was, now all routes should use HTTPS.

Note: This should mainly be done on the server side unless you have no other options.

Sean

Read more posts by this author.