all repos — website @ 37e18e4303da7c42c0840ad66f64400de816809c

My website

redirect OpenID configuration requests to dex
Alan Pearce alan@alanpearce.eu
Tue, 21 May 2024 18:57:30 +0200
commit

37e18e4303da7c42c0840ad66f64400de816809c

parent

6d0e12252261db9308510816f1e473c0cfecf0db

1 files changed, 7 insertions(+), 0 deletions(-)

jump to
M internal/server/server.gointernal/server/server.go
@@ -188,6 +188,13 @@ log.Warn("error writing webfinger request", "error", err) 			}
 		}
 	})
+	const oidcPath = "/.well-known/openid-configuration"
+	mux.HandleFunc(
+		hostname+oidcPath,
+		func(w http.ResponseWriter, r *http.Request) {
+			u := config.OIDCHost.JoinPath(oidcPath)
+			http.Redirect(w, r, u.String(), 302)
+		})
 
 	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 		newURL := runtimeConfig.BaseURL.String() + r.URL.String()