KrisChase.com

Laravel Force HTTPS

Posted in Web Development on 06.10.2015 by @chasebadkids

Using App::before

You might be able to take advantage of the App::before() block in the app/filters.php file.

Change the block to include a simple check to see if the current request is secure, and if not, redirect it.

Using Filters

Another option might be to create a filter like so. People generally store this also in app/filters.php.

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

Individual Route

Route Group

Controller

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

Menu