From 81cfd9280f6f49a08b0058293a29f9cf2885be6a Mon Sep 17 00:00:00 2001 From: Markus Wolf Date: Mon, 18 Mar 2024 19:32:48 +0100 Subject: [PATCH] Add support for oauth2 beind proxy (#730) This change uses the public_url config value to create the oauth2 callback url. --- server/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index 7575f0f8..96be82ad 100644 --- a/server/server.go +++ b/server/server.go @@ -224,11 +224,13 @@ func New(c *Config) (*Server, error) { mux.Handle(pat.Post("/api/simulate/:owner/:repo/:number"), hatpear.Try(simulateHandler)) mux.Handle(pat.Get(oauth2.DefaultRoute), oauth2.NewHandler( oauth2.GetConfig(c.Github, nil), - oauth2.ForceTLS(forceTLS), oauth2.WithStore(&oauth2.SessionStateStore{ Sessions: sessions, }), oauth2.OnLogin(handler.Login(c.Github, basePath, sessions)), + oauth2.WithRedirectURL(publicURL.ResolveReference(&url.URL{ + Path: oauth2.DefaultRoute, + }).String()), )) // additional client routes