From 593420d84dae58e7982c05d5825a5a5d8e553573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20van=20L=C3=BCck?= Date: Sat, 3 Dec 2022 20:43:51 +0100 Subject: [PATCH] Fix wrong url scheme in sudo mode when using reverse proxy --- app/Http/Controllers/AccountController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 89f46e046..c78cb67a9 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -466,6 +466,12 @@ class AccountController extends Controller if($trustDevice == true) { $request->session()->put('sudoTrustDevice', 1); } + + //Fix wrong scheme when using reverse proxy + if(!str_contains($next, 'https') && config('instance.force_https_urls', true)) { + $next = Str::of($next)->replace('http', 'https')->toString(); + } + return redirect($next); } else { return redirect()