Skip to content

Commit ac840c4

Browse files
committed
Valid nginxproxy for http2
1 parent 807b758 commit ac840c4

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

internal/mode/static/state/dataplane/configuration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func buildBaseHTTPConfig(g *graph.Graph) BaseHTTPConfig {
661661
// HTTP2 should be enabled by default
662662
HTTP2: true,
663663
}
664-
if g.NginxProxy == nil {
664+
if g.NginxProxy == nil || !g.NginxProxy.Valid {
665665
return baseConfig
666666
}
667667

internal/mode/static/state/dataplane/configuration_test.go

+52
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,58 @@ func TestBuildConfiguration(t *testing.T) {
20752075
},
20762076
msg: "NginxProxy with tracing config and http2 disabled",
20772077
},
2078+
{
2079+
graph: &graph.Graph{
2080+
GatewayClass: &graph.GatewayClass{
2081+
Source: &v1.GatewayClass{},
2082+
Valid: true,
2083+
},
2084+
Gateway: &graph.Gateway{
2085+
Source: &v1.Gateway{
2086+
ObjectMeta: metav1.ObjectMeta{
2087+
Name: "gw",
2088+
Namespace: "ns",
2089+
},
2090+
},
2091+
Listeners: []*graph.Listener{
2092+
{
2093+
Name: "listener-80-1",
2094+
Source: listener80,
2095+
Valid: true,
2096+
Routes: map[graph.RouteKey]*graph.L7Route{},
2097+
},
2098+
},
2099+
},
2100+
Routes: map[graph.RouteKey]*graph.L7Route{},
2101+
NginxProxy: &graph.NginxProxy{
2102+
Valid: false,
2103+
Source: &ngfAPI.NginxProxy{
2104+
Spec: ngfAPI.NginxProxySpec{
2105+
DisableHTTP2: true,
2106+
Telemetry: &ngfAPI.Telemetry{
2107+
Exporter: &ngfAPI.TelemetryExporter{
2108+
Endpoint: "some-endpoint",
2109+
},
2110+
},
2111+
},
2112+
},
2113+
},
2114+
},
2115+
expConf: Configuration{
2116+
HTTPServers: []VirtualServer{
2117+
{
2118+
IsDefault: true,
2119+
Port: 80,
2120+
},
2121+
},
2122+
SSLServers: []VirtualServer{},
2123+
SSLKeyPairs: map[SSLKeyPairID]SSLKeyPair{},
2124+
CertBundles: map[CertBundleID]CertBundle{},
2125+
BaseHTTPConfig: BaseHTTPConfig{HTTP2: true},
2126+
Telemetry: Telemetry{},
2127+
},
2128+
msg: "invalid NginxProxy",
2129+
},
20782130
{
20792131
graph: &graph.Graph{
20802132
GatewayClass: &graph.GatewayClass{

0 commit comments

Comments
 (0)