Merge pull request #3890 from vanlueckn/feat-fix-sudo-mode-url-scheme

Fix wrong url scheme in sudo mode when using reverse proxy
This commit is contained in:
daniel 2023-03-04 15:03:49 -07:00 committed by GitHub
commit e68ec03cea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -479,6 +479,12 @@ class AccountController extends Controller
if($trustDevice == true) { if($trustDevice == true) {
$request->session()->put('sudoTrustDevice', 1); $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); return redirect($next);
} else { } else {
return redirect() return redirect()