Skip to content

Commit c6ae6aa

Browse files
authored
force https (alexjustesen#299)
1 parent f828431 commit c6ae6aa

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ APP_ENV=production
33
APP_KEY=
44
APP_DEBUG=false
55
APP_URL=http://localhost
6+
FORCE_HTTPS=false
67

78
LOG_CHANNEL=stderr
89
LOG_DEPRECATIONS_CHANNEL=null

app/Providers/AppServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
use Illuminate\Support\Facades\URL;
56
use Illuminate\Support\ServiceProvider;
67

78
class AppServiceProvider extends ServiceProvider
@@ -25,6 +26,8 @@ public function register()
2526
*/
2627
public function boot()
2728
{
28-
//
29+
if (config('app.force_https')) {
30+
URL::forceScheme('https');
31+
}
2932
}
3033
}

config/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858

5959
'asset_url' => env('ASSET_URL'),
6060

61+
'force_https' => env('FORCE_HTTPS', false),
62+
6163
/*
6264
|--------------------------------------------------------------------------
6365
| Application Timezone

0 commit comments

Comments
 (0)