Skip to content

Commit 81b5655

Browse files
committed
update key for match.json
1 parent 7897819 commit 81b5655

File tree

2 files changed

+15
-45
lines changed

2 files changed

+15
-45
lines changed

internal/mode/static/nginx/config/servers.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func createLocations(server *dataplane.VirtualServer, serverID int) ([]http.Loca
157157
}
158158

159159
if len(matches) > 0 {
160-
for i, loc := range extLocations {
160+
for i := range extLocations {
161161
// FIXME(sberman): De-dupe matches and associated locations
162162
// so we don't need nginx/njs to perform unnecessary matching.
163163
// https://github.com/nginxinc/nginx-gateway-fabric/issues/662
@@ -166,9 +166,6 @@ func createLocations(server *dataplane.VirtualServer, serverID int) ([]http.Loca
166166
key = "SSL"
167167
}
168168
key += strconv.Itoa(serverID) + "_" + strconv.Itoa(pathRuleIdx)
169-
if strings.Contains(loc.Path, "= /") {
170-
key += "EXACT"
171-
}
172169
extLocations[i].HTTPMatchKey = key
173170
matchPairs[extLocations[i].HTTPMatchKey] = matches
174171
}

internal/mode/static/nginx/config/servers_test.go

+14-41
Original file line numberDiff line numberDiff line change
@@ -530,39 +530,18 @@ func TestCreateServers(t *testing.T) {
530530
"1_6": {
531531
{RedirectPath: "@rule6-route0", Headers: []string{"redirect:this"}},
532532
},
533-
"1_6EXACT": {
534-
{
535-
RedirectPath: "@rule6-route0",
536-
Headers: []string{"redirect:this"},
537-
},
538-
},
539533
"1_8": {
540534
{
541535
Headers: []string{"rewrite:this"},
542536
RedirectPath: "@rule8-route0",
543537
},
544538
},
545-
"1_8EXACT": {
546-
{
547-
RedirectPath: "@rule8-route0",
548-
Headers: []string{"rewrite:this"},
549-
},
550-
},
551539
"1_10": {
552540
{
553541
Headers: []string{"filter:this"},
554542
RedirectPath: "@rule10-route0",
555543
},
556544
},
557-
"1_10EXACT": {
558-
{
559-
Headers: []string{"filter:this"},
560-
RedirectPath: "@rule10-route0",
561-
},
562-
},
563-
"1_12EXACT": {
564-
{Method: "GET", RedirectPath: "@rule12-route0"},
565-
},
566545
"SSL1_0": {
567546
{Method: "POST", RedirectPath: "@rule0-route0"},
568547
{Method: "PATCH", RedirectPath: "@rule0-route1"},
@@ -579,40 +558,34 @@ func TestCreateServers(t *testing.T) {
579558
"SSL1_6": {
580559
{RedirectPath: "@rule6-route0", Headers: []string{"redirect:this"}},
581560
},
582-
"SSL1_6EXACT": {
583-
{
584-
Headers: []string{"redirect:this"},
585-
RedirectPath: "@rule6-route0",
586-
},
587-
},
588561
"SSL1_8": {
589562
{
590563
Headers: []string{"rewrite:this"},
591564
RedirectPath: "@rule8-route0",
592565
},
593566
},
594-
"SSL1_8EXACT": {
595-
{
596-
RedirectPath: "@rule8-route0",
597-
Headers: []string{"rewrite:this"},
598-
},
599-
},
600567
"SSL1_10": {
601568
{
602569
RedirectPath: "@rule10-route0",
603570
Headers: []string{"filter:this"},
604571
},
605572
},
606-
"SSL1_10EXACT": {
573+
"1_12": {
607574
{
608-
RedirectPath: "@rule10-route0",
609-
Headers: []string{"filter:this"},
575+
Method: "GET",
576+
RedirectPath: "@rule12-route0",
577+
Headers: nil,
578+
QueryParams: nil,
579+
Any: false,
610580
},
611581
},
612-
"SSL1_12EXACT": {
582+
"SSL1_12": {
613583
{
614584
Method: "GET",
615585
RedirectPath: "@rule12-route0",
586+
Headers: nil,
587+
QueryParams: nil,
588+
Any: false,
616589
},
617590
},
618591
}
@@ -742,7 +715,7 @@ func TestCreateServers(t *testing.T) {
742715
},
743716
{
744717
Path: "= /redirect-with-headers",
745-
HTTPMatchKey: ssl + "1_6" + "EXACT",
718+
HTTPMatchKey: ssl + "1_6",
746719
},
747720
{
748721
Path: "/rewrite/",
@@ -768,7 +741,7 @@ func TestCreateServers(t *testing.T) {
768741
},
769742
{
770743
Path: "= /rewrite-with-headers",
771-
HTTPMatchKey: ssl + "1_8" + "EXACT",
744+
HTTPMatchKey: ssl + "1_8",
772745
},
773746
{
774747
Path: "/invalid-filter/",
@@ -794,7 +767,7 @@ func TestCreateServers(t *testing.T) {
794767
},
795768
{
796769
Path: "= /invalid-filter-with-headers",
797-
HTTPMatchKey: ssl + "1_10" + "EXACT",
770+
HTTPMatchKey: ssl + "1_10",
798771
},
799772
{
800773
Path: "= /exact",
@@ -808,7 +781,7 @@ func TestCreateServers(t *testing.T) {
808781
},
809782
{
810783
Path: "= /test",
811-
HTTPMatchKey: ssl + "1_12" + "EXACT",
784+
HTTPMatchKey: ssl + "1_12",
812785
},
813786
{
814787
Path: "/proxy-set-headers/",

0 commit comments

Comments
 (0)