Skip to content

Commit

Permalink
Update oidc redirect_uri to check x-forwarded-proto header for proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Nov 19, 2023
1 parent a0f1379 commit aa933df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ class Auth {
// We need to call the client manually, because the strategy does not support forwarding the code challenge
// for API or mobile clients
const oidcStrategy = passport._strategy('openid-client')
const protocol = req.secure ? 'https' : 'http'
const protocol = (req.secure || req.get('x-forwarded-proto') === 'https') ? 'https' : 'http'
oidcStrategy._params.redirect_uri = new URL(`${protocol}://${req.get('host')}/auth/openid/callback`).toString()
Logger.debug(`[Auth] Set oidc redirect_uri=${oidcStrategy._params.redirect_uri}`)
const client = oidcStrategy._client
const sessionKey = oidcStrategy._key

Expand Down

0 comments on commit aa933df

Please sign in to comment.