From fce8ab7cf98f9111e0a0294055fea3ed32e53756 Mon Sep 17 00:00:00 2001 From: Steven Rhodes Date: Sun, 1 Sep 2024 11:48:24 -0700 Subject: [PATCH] Fix protocol --- src/auth.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index db3a87b..5ef75b9 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -87,11 +87,13 @@ struct Claims { fn self_uri(req: &Request) -> String { if let Some(host) = req.header("Host") { - let prefix = if req.is_secure() { - "https://" - } else { - "http://" - }; + let prefix = + if !req.is_secure() && !host.starts_with("localhost") && !host.starts_with("127.0.0.1") + { + "http://" + } else { + "https://" + }; format!("{prefix}{host}") } else { "".into()