From e57057b5ee333fc176ec035209aa48b306839912 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Tue, 26 Oct 2021 15:05:03 -0400 Subject: [PATCH] Force https for OIDC behind proxy --- publish.ps1 | 1 + src/MyPrayerJournal/Program.fs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) mode change 100644 => 100755 publish.ps1 diff --git a/publish.ps1 b/publish.ps1 old mode 100644 new mode 100755 index c62b157..55d7390 --- a/publish.ps1 +++ b/publish.ps1 @@ -1,2 +1,3 @@ +#!/snap/bin/pwsh Set-Location src/MyPrayerJournal dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained false \ No newline at end of file diff --git a/src/MyPrayerJournal/Program.fs b/src/MyPrayerJournal/Program.fs index 963f957..2a0c423 100644 --- a/src/MyPrayerJournal/Program.fs +++ b/src/MyPrayerJournal/Program.fs @@ -125,6 +125,12 @@ module Configure = |> ctx.Response.Redirect ctx.HandleResponse () + Task.CompletedTask + opts.Events.OnRedirectToIdentityProvider <- fun ctx -> + let bldr = UriBuilder ctx.ProtocolMessage.RedirectUri + bldr.Scheme <- cfg["Scheme"] + bldr.Port <- int cfg["Port"] + ctx.ProtocolMessage.RedirectUri <- string bldr Task.CompletedTask ) |> ignore @@ -153,12 +159,7 @@ module Configure = .UseRouting() .UseAuthentication() .UseGiraffeErrorHandler(Handlers.Error.error) - // .UseAuthorization() - .UseEndpoints (fun e -> - e.MapGiraffeEndpoints Handlers.routes - // TODO: fallback to 404 - // e.MapFallbackToFile "index.html" - |> ignore) + .UseEndpoints (fun e -> e.MapGiraffeEndpoints Handlers.routes |> ignore) |> ignore app