···3939 match Uri.scheme u with
4040 | Some "https" when host <> Some "localhost" ->
4141 ()
4242- | Some "http" when host = Some "127.0.0.1" || host = Some "[::1]" ->
4242+ | Some "http"
4343+ when host = Some "127.0.0.1" || host = Some "localhost"
4444+ || host = Some "[::1]" ->
4345 ()
4446 | _ ->
4547 failwith ("invalid redirect_uri: " ^ uri) )
+14-3
pegasus/lib/oauth/dpop.ml
···7373 if Hashtbl.length jti_cache mod 100 = 0 then cleanup_jti_cache () ;
7474 true )
75757676+let is_loopback host =
7777+ host = "127.0.0.1" || host = "[::1]" || host = "localhost"
7878+7679let normalize_url url =
7780 let uri = Uri.of_string url in
7878- Uri.make ~scheme:"https"
7979- ~host:(Uri.host uri |> Option.value ~default:Env.hostname)
8080- ~path:(Uri.path uri) ()
8181+ let host = Uri.host uri in
8282+ let scheme, normalized_host =
8383+ match host with
8484+ | Some h when is_loopback h ->
8585+ ("http", h)
8686+ | Some h ->
8787+ ("https", h)
8888+ | None ->
8989+ ("https", Env.hostname)
9090+ in
9191+ Uri.make ~scheme ~host:normalized_host ~path:(Uri.path uri) ()
8192 |> Uri.to_string
82938394let compute_jwk_thumbprint jwk =