Skip to content

Firefly III: a personal finances manager

Force https schema if APP_FORCE_SSL=true in .env

zjeancb1cb9f328c1
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');
+ }
}
/**