@@ -137,7 +137,7 @@ func TestExecuteServers(t *testing.T) {
137
137
}
138
138
}
139
139
140
- func TestExecuteServersForIPFamily (t * testing.T ) {
140
+ func TestExecuteServerConfig (t * testing.T ) {
141
141
httpServers := []dataplane.VirtualServer {
142
142
{
143
143
IsDefault : true ,
@@ -230,6 +230,30 @@ func TestExecuteServersForIPFamily(t *testing.T) {
230
230
"listen [::]:8443 ssl;" : 1 ,
231
231
},
232
232
},
233
+ {
234
+ msg : "http and ssl servers with proxy protocol enabled" ,
235
+ config : dataplane.Configuration {
236
+ HTTPServers : httpServers ,
237
+ SSLServers : sslServers ,
238
+ BaseHTTPConfig : dataplane.BaseHTTPConfig {
239
+ ProxyProtocol : true ,
240
+ },
241
+ },
242
+ expectedHTTPConfig : map [string ]int {
243
+ "listen 8080 default_server;" : 1 ,
244
+ "listen 8080 proxy_protocol;" : 1 ,
245
+ "listen 8443 ssl default_server;" : 1 ,
246
+ "listen 8443 ssl proxy_protocol;" : 1 ,
247
+ "server_name example.com;" : 2 ,
248
+ "ssl_certificate /etc/nginx/secrets/test-keypair.pem;" : 1 ,
249
+ "ssl_certificate_key /etc/nginx/secrets/test-keypair.pem;" : 1 ,
250
+ "ssl_reject_handshake on;" : 1 ,
251
+ "listen [::]:8080 default_server;" : 1 ,
252
+ "listen [::]:8080 proxy_protocol;" : 1 ,
253
+ "listen [::]:8443 ssl default_server;" : 1 ,
254
+ "listen [::]:8443 ssl proxy_protocol;" : 1 ,
255
+ },
256
+ },
233
257
}
234
258
235
259
for _ , test := range tests {
0 commit comments