Force x-forwarded-proto to https for OIDC endpoints

This commit is contained in:
Jennie Robinson Faber 2026-03-01 16:53:38 +00:00
parent a3b4f1118c
commit e4813075b7
2 changed files with 4 additions and 8 deletions

View file

@ -14,10 +14,8 @@ export default defineEventHandler(async (event) => {
// The provider expects the path relative to its root
req.url = "/.well-known/openid-configuration";
// Ensure the provider sees https when behind Traefik
if (!req.headers["x-forwarded-proto"]) {
req.headers["x-forwarded-proto"] = "https";
}
// Traefik terminates TLS — tell the provider we're on https
req.headers["x-forwarded-proto"] = "https";
const callback = provider.callback() as Function;
await new Promise<void>((resolve, reject) => {

View file

@ -17,10 +17,8 @@ export default defineEventHandler(async (event) => {
// The provider's routes config includes the /oidc prefix,
// so pass the full path through without stripping.
// Ensure the provider sees https when behind Traefik
if (!req.headers["x-forwarded-proto"]) {
req.headers["x-forwarded-proto"] = "https";
}
// Traefik terminates TLS — tell the provider we're on https
req.headers["x-forwarded-proto"] = "https";
// Hand off to oidc-provider's Connect-style callback
const callback = provider.callback() as Function;