jkniest/force-https

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel Middleware to force a secure connection

1.0.2 2017-12-14 20:36 UTC

This package is not auto-updated.

Last update: 2020-01-24 17:03:06 UTC


README

Latest Stable Version Total Downloads License StyleCI

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)

Installation

  1. In order to install the package, just run the following command in the root directory of your laravel installation:
composer require jkniest/force-https
  1. If you are using Laravel 5.4 oder below, open the config/app.php file and add the following code to the providers array:
jkniest\ForceHttps\ForceHttpsServiceProvider::class,
  1. Run the command below to copy the configuration files to your config folder
php artisan vendor:publish --tag="force-https"
  1. Add the following line to the .env file
FORCE_HTTPS=true
  1. Open the app/Http/Kernel.php file and add the following code to the middleware array:
\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

License

The ForceHttps package is open-sourced software licensed under the MIT license.