It seems this has changed in laravel 5.4 from schema to scheme:
https://laracasts.com/discuss/channels/laravel/forcescheme-or-forceschema-in-laravel-54
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using URL::forceSchema('https') to force SSL on my Laravel 5.3 application. However, it only works after login (even the login page isn't being covered with https).
I'm also using TrustedProxy and I'm hosting my application on Heroku.
Guys, thank you much for giving it a try. I finally got it working by adding the following code to register() method of AppServiceProvider
if (env('APP_ENV') === 'production') {
$this->app['request']->server->set('HTTPS', true);
}
I found this solution on: https://laracasts.com/discuss/channels/laravel/force-ssl-secure-routes-in-laravel-52?page=1
Please or to participate in this conversation.