You can then enforce that new filter to any of your routes, route groups, or controllers like this.

Individual Route

Route::get('something',['before'=>'force.ssl'],function(){return"This will be forced SSL";});

Route Group

Route::group(['before'=>'force.ssl'],function(){// Routes here.});

Controller

You’ll need to do this in your controller’s __construct() method.

publicfunction __construct(){$this->beforeFilter('force.ssl');
}

—————————————————–/OR/——————————————————-

Another answer might be to let your web server handle this. If you are using Apache, you can use the RedirectSSL feature to make sure all requests are going to the HTTPS version of your site, and if not redirect them. This will happen before Laravel even get’s the request.

If you’re on NGINX, you can accomplish this by having two server blocks. One for normal HTTPS on port 80, and another for HTTPS on port 443. Then configure the normal server block to always redirect to ssl version.