jkniest / force-https
Laravel Middleware to force a secure connection
Installs: 1 085
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jkniest/force-https
Requires
- laravel/framework: >5.1
This package is not auto-updated.
Last update: 2020-01-24 17:03:06 UTC
README
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
- In order to install the package, just run the following command in the root directory of your laravel installation:
composer require jkniest/force-https
- If you are using Laravel 5.4 oder below, open the config/app.phpfile and add the following code to theprovidersarray:
jkniest\ForceHttps\ForceHttpsServiceProvider::class,
- Run the command below to copy the configuration files to your configfolder
php artisan vendor:publish --tag="force-https"
- Add the following line to the .envfile
FORCE_HTTPS=true
- Open the app/Http/Kernel.phpfile and add the following code to themiddlewarearray:
\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.