phucnguyenvn / laravel-force-https-middleware
Laravel module which force all request to https protocol
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/phucnguyenvn/laravel-force-https-middleware
Requires
- php: >=5.4.0
- illuminate/config: ^5.1
- illuminate/database: ^5.1
- illuminate/support: ^5.1
This package is auto-updated.
Last update: 2025-09-29 02:42:20 UTC
README
Laravel module which force all request to https protocol
Installation
Installing via Composer
composer require phucnguyenvn/laravel-force-https-middleware
Usage
To get started apply this middleware to every request adding setting the rule at Kernel.php file, like so:
Example:
/** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, // Appending custom middleware \PhucNguyenVn\Http\Middleware\ForceHttps::class ];
Now the middleware will redirect every request to https if:
The current request comes with no secure protocol (http) If your environment is equals to production.
Test
composer test