From cb1cb9f328c138275242f2a70e94fcb7ddfeef32 Mon Sep 17 00:00:00 2001 From: zjean Date: Wed, 4 May 2016 22:09:42 +0200 Subject: [PATCH] Force https schema if APP_FORCE_SSL=true in .env --- .env.example | 1 + .env.testing | 1 + app/Providers/AppServiceProvider.php | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index dcca3ab865..59778fd8b8 100755 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ APP_ENV=production APP_DEBUG=false +APP_FORCE_SSL=true APP_KEY=SomeRandomStringOf32CharsExactly LOG_LEVEL=warning diff --git a/.env.testing b/.env.testing index 852745ab42..8aeacddc74 100755 --- a/.env.testing +++ b/.env.testing @@ -1,5 +1,6 @@ APP_ENV=testing APP_DEBUG=true +APP_FORCE_SSL=false APP_KEY=SomeRandomStringOf32CharsExactly LOG_LEVEL=debug diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 544d2465a9..27b2a18de0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -20,7 +20,10 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - // + // force https urls + if (env('APP_FORCE_SSL', false)) { + \URL::forceSchema('https'); + } } /**