Force HTTPS Middleware
, (*1)
This package only does one thing: Force a connection through https! If a user visit the site with an unsecure "http"-Request (example: http://example.com) he will be automatically redirected to a secure route (example: https://example.com), (*2)
Installation
1) In order to install the package, just run the following command in the root directory of your laravel installation:, (*3)
composer require jkniest/force-https
2) If you are using Laravel 5.4 oder below, open the config/app.php file and add the following code to the providers array:, (*4)
jkniest\ForceHttps\ForceHttpsServiceProvider::class,
3) Run the command below to copy the configuration files to your config folder, (*5)
php artisan vendor:publish --tag="force-https"
4) Add the following line to the .env file, (*6)
FORCE_HTTPS=true
5) Open the app/Http/Kernel.php file and add the following code to the middleware array:, (*7)
\jkniest\ForceHttps\ForceHttps::class,
To disable the https-redirection (for example on staging servers) just change the FORCE_HTTPS=true in your .env file to FORCE_HTTPS=false, (*8)
License
The ForceHttps package is open-sourced software licensed under the MIT license., (*9)