You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-01 22:51:45 +02:00
Use bool pointers for upstream options that default to true
This commit is contained in:
@@ -77,8 +77,8 @@ func (l *LegacyUpstreams) convert() (Upstreams, error) {
|
||||
Path: u.Path,
|
||||
URI: upstreamString,
|
||||
InsecureSkipTLSVerify: l.SSLUpstreamInsecureSkipVerify,
|
||||
PassHostHeader: l.PassHostHeader,
|
||||
ProxyWebSockets: l.ProxyWebSockets,
|
||||
PassHostHeader: &l.PassHostHeader,
|
||||
ProxyWebSockets: &l.ProxyWebSockets,
|
||||
FlushInterval: &l.FlushInterval,
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ func (l *LegacyUpstreams) convert() (Upstreams, error) {
|
||||
// Force defaults compatible with static responses
|
||||
upstream.URI = ""
|
||||
upstream.InsecureSkipTLSVerify = false
|
||||
upstream.PassHostHeader = true
|
||||
upstream.ProxyWebSockets = false
|
||||
upstream.PassHostHeader = nil
|
||||
upstream.ProxyWebSockets = nil
|
||||
flush := 1 * time.Second
|
||||
upstream.FlushInterval = &flush
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ var _ = Describe("Legacy Options", func() {
|
||||
legacyOpts.LegacyUpstreams.SSLUpstreamInsecureSkipVerify = true
|
||||
legacyOpts.LegacyUpstreams.Upstreams = []string{"http://foo.bar/baz", "file://var/lib/website#/bar"}
|
||||
|
||||
truth := true
|
||||
opts.UpstreamServers = Upstreams{
|
||||
{
|
||||
ID: "/baz",
|
||||
@@ -30,8 +31,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
URI: "http://foo.bar/baz",
|
||||
FlushInterval: &flushInterval,
|
||||
InsecureSkipTLSVerify: true,
|
||||
PassHostHeader: true,
|
||||
ProxyWebSockets: true,
|
||||
PassHostHeader: &truth,
|
||||
ProxyWebSockets: &truth,
|
||||
},
|
||||
{
|
||||
ID: "/bar",
|
||||
@@ -39,8 +40,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
URI: "file://var/lib/website#/bar",
|
||||
FlushInterval: &flushInterval,
|
||||
InsecureSkipTLSVerify: true,
|
||||
PassHostHeader: true,
|
||||
ProxyWebSockets: true,
|
||||
PassHostHeader: &truth,
|
||||
ProxyWebSockets: &truth,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -72,8 +73,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
Path: "/baz",
|
||||
URI: validHTTP,
|
||||
InsecureSkipTLSVerify: skipVerify,
|
||||
PassHostHeader: passHostHeader,
|
||||
ProxyWebSockets: proxyWebSockets,
|
||||
PassHostHeader: &passHostHeader,
|
||||
ProxyWebSockets: &proxyWebSockets,
|
||||
FlushInterval: &flushInterval,
|
||||
}
|
||||
|
||||
@@ -84,8 +85,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
Path: "/",
|
||||
URI: emptyPathHTTP,
|
||||
InsecureSkipTLSVerify: skipVerify,
|
||||
PassHostHeader: passHostHeader,
|
||||
ProxyWebSockets: proxyWebSockets,
|
||||
PassHostHeader: &passHostHeader,
|
||||
ProxyWebSockets: &proxyWebSockets,
|
||||
FlushInterval: &flushInterval,
|
||||
}
|
||||
|
||||
@@ -95,8 +96,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
Path: "/bar",
|
||||
URI: validFileWithFragment,
|
||||
InsecureSkipTLSVerify: skipVerify,
|
||||
PassHostHeader: passHostHeader,
|
||||
ProxyWebSockets: proxyWebSockets,
|
||||
PassHostHeader: &passHostHeader,
|
||||
ProxyWebSockets: &proxyWebSockets,
|
||||
FlushInterval: &flushInterval,
|
||||
}
|
||||
|
||||
@@ -109,8 +110,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
Static: true,
|
||||
StaticCode: &validStaticCode,
|
||||
InsecureSkipTLSVerify: false,
|
||||
PassHostHeader: true,
|
||||
ProxyWebSockets: false,
|
||||
PassHostHeader: nil,
|
||||
ProxyWebSockets: nil,
|
||||
FlushInterval: &defaultFlushInterval,
|
||||
}
|
||||
|
||||
@@ -123,8 +124,8 @@ var _ = Describe("Legacy Options", func() {
|
||||
Static: true,
|
||||
StaticCode: &invalidStaticCode,
|
||||
InsecureSkipTLSVerify: false,
|
||||
PassHostHeader: true,
|
||||
ProxyWebSockets: false,
|
||||
PassHostHeader: nil,
|
||||
ProxyWebSockets: nil,
|
||||
FlushInterval: &defaultFlushInterval,
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ type Upstream struct {
|
||||
// PassHostHeader determines whether the request host header should be proxied
|
||||
// to the upstream server.
|
||||
// Defaults to true.
|
||||
PassHostHeader bool `json:"passHostHeader"`
|
||||
PassHostHeader *bool `json:"passHostHeader"`
|
||||
|
||||
// ProxyWebSockets enables proxying of websockets to upstream servers
|
||||
// Defaults to true.
|
||||
ProxyWebSockets bool `json:"proxyWebSockets"`
|
||||
ProxyWebSockets *bool `json:"proxyWebSockets"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user