1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-17 00:17:40 +02:00

Ensure redirect URI always has a scheme

This commit is contained in:
Joel Speed
2021-02-14 11:38:20 +00:00
committed by Joel Speed
parent f3209a40e1
commit 9dbd5f5afd
3 changed files with 12 additions and 3 deletions

View File

@ -35,6 +35,7 @@ import (
)
const (
schemeHTTP = "http"
schemeHTTPS = "https"
applicationJSON = "application/json"
)
@ -971,6 +972,11 @@ func (p *OAuthProxy) getOAuthRedirectURI(req *http.Request) string {
rd.Host = requestutil.GetRequestHost(req)
rd.Scheme = requestutil.GetRequestProto(req)
// If there's no scheme in the request, we should still include one
if rd.Scheme == "" {
rd.Scheme = schemeHTTP
}
// If CookieSecure is true, return `https` no matter what
// Not all reverse proxies set X-Forwarded-Proto
if p.CookieSecure {