Created
September 30, 2015 19:53
-
-
Save kyleridolfo/4e9c5f9bfa855c2bd63f to your computer and use it in GitHub Desktop.
Revisions
-
nblackburn revised this gist
Jul 31, 2015 . 1 changed file with 1 addition and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,6 @@ use Closure; use Illuminate\Contracts\Routing\Middleware; /** * Secure @@ -14,16 +13,10 @@ */ class Secure implements Middleware { public function handle($request, Closure $next) { if (!$request->secure() && app()->environment('production')) { return redirect()->secure($request->getRequestUri()); } -
nblackburn revised this gist
Nov 12, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use Closure; use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\Foundation\Application; /** * Secure -
nblackburn revised this gist
Nov 12, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,8 @@ * @param $next The next closure. * @return redirects to the secure counterpart of the requested uri. */ class Secure implements Middleware { protected $app; public function __construct(Application $app) -
nblackburn revised this gist
Nov 12, 2014 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,9 +13,16 @@ */ class Secure implements Middleware { protected $app; public function __construct(Application $app) { $this->app = $app; } public function handle($request, Closure $next) { if (!$request->secure() && $this->app->environment() === 'production') { return redirect()->secure($request->getRequestUri()); } -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ I noticed that Laravel 5 doesn't have a secure (_https_) middleware since the removal of filters. So i have re-implemented it and shared the code in the hope that you find it useful. ## Installation @@ -7,5 +7,5 @@ I noticed that Laravel 5 doesn't have a secure (_https_) filter so i have re-imp ## Notes - If you are using route annotations, don't forget to re-scan your routes using the `php artisan route:scan` command. - The redirect is disabled in any non-production environment (_as you likely won't have acquired a certificate at this stage_). -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ /** * Secure * Redirects any non-secure requests to their secure counterparts. * * @param request The request object. * @param $next The next closure. -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ /** * Secure * Redirects any non-secure links to their secure counterparts. * * @param request The request object. * @param $next The next closure. * @return redirects to the secure counterpart of the requested uri. -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,13 @@ use Closure; use Illuminate\Contracts\Routing\Middleware; /** * Secure * Redirects any non-secure links to their secure counterparts. * @param request The request object. * @param $next The next closure. * @return redirects to the secure counterpart of the requested uri. */ class Secure implements Middleware { public function handle($request, Closure $next) -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,4 @@ I noticed that Laravel 5 doesn't have a secure (_https_) filter so i have re-imp ## Notes - If you are using route annotations, don't forget to rescan your routes using the `php artisan route:scan` command. - The redirect is disabled in any non-production environment (as you likely won't have acquired a certificate at this stage). -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,13 @@ I noticed that Laravel 5 doesn't have a secure (_https_) filter so i have re-implemented it in the form of a middleware, i hope that you find this useful. ## Installation - Add `Secure.php` to your `app\Http\Middleware` directory. - Add the secure middleware to your route. ## Notes - If you are using route annotations, don't forget to rescan your routes using the `php artisan route:scan` command. - The redirect is disabled in any non-production environment (as you likely won't have acquired a certificate at this stage). [Gist](https://gist.github.com/nblackburn/a66e8e93561e277996aa) -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # Secure Middleware for Laravel 5 I noticed that Laravel 5 doesn't have a secure (_https_) filter so i have re-implemented it in the form of a middleware, i hope that you find this useful. ## Installation - Add `Secure.php` to your `app\Http\Middleware` directory. -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,4 +7,4 @@ ## Notes - If you are using route annotations, don't forget to rescan your routes using the `php artisan route:scan` command. -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ - Add `Secure.php` to your `app\Http\Middleware` directory. - Add the secure middleware to your route. ## Notes -
nblackburn revised this gist
Nov 3, 2014 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,11 @@ # Secure Middleware for Laravel 5 ## Installation - Add `Secure.php` to your `app\Http\Middleware` directory. - Add the secure middleware to your route. - run `php artisan route:scan`. ## Notes If you are using route annotations, don't forget to rescan your routes using the `php artisan route:scan` command. -
nblackburn created this gist
Nov 3, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Secure Middleware for Laravel 5 ## Installation - Add `Secure.php` to your `app\Http\Middleware` directory. - Add the secure middleware to your route` - run `php artisan route:scan` ## Notes If you are using route annotations, don't forget to rescan your routes using the `php artisan route:scan` command. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <?php namespace App\Http\Middleware; use Closure; use Illuminate\Contracts\Routing\Middleware; class Secure implements Middleware { public function handle($request, Closure $next) { if (!$request->secure() && \App::environment() === 'production') { return redirect()->secure($request->getRequestUri()); } return $next($request); } }