fix: static upstream validation failure

Signed-off-by: Sourav Agrawal <souravagr01@gmail.com>
This commit is contained in:
Sourav Agrawal 2026-01-15 23:25:46 +05:30 committed by Jan Larwig
parent 9c61c49ec2
commit c5019117ef
No known key found for this signature in database
GPG Key ID: C2172BFA220A037A
2 changed files with 12 additions and 6 deletions

View File

@ -9,6 +9,7 @@
## Changes since v7.14.0
- [#3309](https://github.com/oauth2-proxy/oauth2-proxy/pull/3309) fix: Return 302 redirect from AuthOnly endpoint when skip-provider-button is true (@StefanMarkmann)
- [#3302](https://github.com/oauth2-proxy/oauth2-proxy/pull/3302) fix: static upstreams failing validation due to `passHostHeader` and `proxyWebSockets` defaults being set incorrectly (@sourava01)
# V7.14.0

View File

@ -146,16 +146,21 @@ func (u *Upstream) EnsureDefaults() {
if u.FlushInterval == nil {
u.FlushInterval = ptr.To(DefaultUpstreamFlushInterval)
}
if u.PassHostHeader == nil {
u.PassHostHeader = ptr.To(DefaultUpstreamPassHostHeader)
}
if u.ProxyWebSockets == nil {
u.ProxyWebSockets = ptr.To(DefaultUpstreamProxyWebSockets)
}
if u.Timeout == nil {
u.Timeout = ptr.To(DefaultUpstreamTimeout)
}
if u.DisableKeepAlives == nil {
u.DisableKeepAlives = ptr.To(DefaultUpstreamDisableKeepAlives)
}
// PassHostHeader and ProxyWebSockets must remain nil for static upstreams
// as they don't apply and validation will flag them if set
if !ptr.Deref(u.Static, DefaultUpstreamStatic) {
if u.PassHostHeader == nil {
u.PassHostHeader = ptr.To(DefaultUpstreamPassHostHeader)
}
if u.ProxyWebSockets == nil {
u.ProxyWebSockets = ptr.To(DefaultUpstreamProxyWebSockets)
}
}
}