Skip to content

Commit

Permalink
Fix protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
stvnrhodes committed Sep 1, 2024
1 parent f8538bb commit fce8ab7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fce8ab7

Please sign in to comment.