https://github.com/ecrmnn/laravel-https
🔒 Redirect all requests to HTTPS. Also works with load balancing, AWS, Heroku and other services
https://github.com/ecrmnn/laravel-https
https laravel laravel-package middleware php7 secure
Last synced: 9 months ago
JSON representation
🔒 Redirect all requests to HTTPS. Also works with load balancing, AWS, Heroku and other services
- Host: GitHub
- URL: https://github.com/ecrmnn/laravel-https
- Owner: ecrmnn
- Created: 2017-07-18T06:35:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-17T19:08:41.000Z (over 8 years ago)
- Last Synced: 2025-03-19T07:53:58.300Z (9 months ago)
- Topics: https, laravel, laravel-package, middleware, php7, secure
- Language: PHP
- Homepage: https://packagist.org/packages/ecrmnn/laravel-https
- Size: 38.1 KB
- Stars: 60
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 
> Generate HTTPS-links and redirect all requests to HTTPS. Also works with load balancing, AWS, Heroku and other
services
[](https://travis-ci.org/ecrmnn/laravel-https/builds)
[](https://packagist.org/packages/ecrmnn/laravel-https)
[](https://opensource.org/licenses/MIT)
[](http://makeapullrequest.com)
[](http://www.php-fig.org/psr/psr-2/)
### Installation
##### Add to your project using Composer
```bash
composer require ecrmnn/laravel-https
```
##### Add under ``providers`` in ``config/app.php``
```php
\Ecrmnn\LaravelHttps\Providers\ServiceProvider::class,
```
##### Add under ``$middleware`` in ``app/Http/Kernel.php``
```php
\Ecrmnn\LaravelHttps\Http\Middleware\ForceHttps::class,
```
### Usage
##### Set environment variable
*HTTPS will only be forced when ``env('HTTPS')`` is set to ``true``*
```bash
HTTPS=true
```
### What is this?
##### Generate HTTPS-links automagically
``LaravelHTTPS`` forces the URL scheme in Laravel to use the HTTPS prefix for all links generated using ``url()``
and ``route()``. That mean that all your links can be converted to use HTTPS just by installing ``LaravelHTTPS``
##### Force redirect HTTP to HTTPS
With the middleware included; ``ForceHttps``, you can simply specify that as a global middleware and all requests
will be redirected correctly when accessing a non-HTTPS URL.
### Requirements
- Laravel 5.0 +
- PHP 7 +
### License
MIT © [Daniel Eckermann](http://danieleckermann.com)