@@ -291,12 +291,10 @@ func createLocations(
291
291
if ! needsInternalLocations (rule ) {
292
292
for _ , r := range rule .MatchRules {
293
293
extLocations = updateLocations (
294
- r .Filters ,
295
- extLocations ,
296
294
r ,
295
+ rule ,
296
+ extLocations ,
297
297
server .Port ,
298
- rule .Path ,
299
- rule .GRPC ,
300
298
keepAliveCheck ,
301
299
mirrorPercentage ,
302
300
)
@@ -315,12 +313,10 @@ func createLocations(
315
313
)
316
314
317
315
intLocation = updateLocation (
318
- r .Filters ,
319
- intLocation ,
320
316
r ,
317
+ rule ,
318
+ intLocation ,
321
319
server .Port ,
322
- rule .Path ,
323
- rule .GRPC ,
324
320
keepAliveCheck ,
325
321
mirrorPercentage ,
326
322
)
@@ -453,15 +449,17 @@ func initializeInternalLocation(
453
449
454
450
// updateLocation updates a location with any relevant configurations, like proxy_pass, filters, tls settings, etc.
455
451
func updateLocation (
456
- filters dataplane.HTTPFilters ,
457
- location http.Location ,
458
452
matchRule dataplane.MatchRule ,
453
+ pathRule dataplane.PathRule ,
454
+ location http.Location ,
459
455
listenerPort int32 ,
460
- path string ,
461
- grpc bool ,
462
456
keepAliveCheck keepAliveChecker ,
463
457
mirrorPercentage * float64 ,
464
458
) http.Location {
459
+ filters := matchRule .Filters
460
+ path := pathRule .Path
461
+ grpc := pathRule .GRPC
462
+
465
463
if filters .InvalidFilter != nil {
466
464
location .Return = & http.Return {Code : http .StatusInternalServerError }
467
465
return location
@@ -588,25 +586,21 @@ func updateLocationProxySettings(
588
586
// updateLocations updates the existing locations with any relevant configurations, like proxy_pass,
589
587
// filters, tls settings, etc.
590
588
func updateLocations (
591
- filters dataplane.HTTPFilters ,
592
- buildLocations []http.Location ,
593
589
matchRule dataplane.MatchRule ,
590
+ pathRule dataplane.PathRule ,
591
+ buildLocations []http.Location ,
594
592
listenerPort int32 ,
595
- path string ,
596
- grpc bool ,
597
593
keepAliveCheck keepAliveChecker ,
598
594
mirrorPercentage * float64 ,
599
595
) []http.Location {
600
596
updatedLocations := make ([]http.Location , len (buildLocations ))
601
597
602
598
for i , loc := range buildLocations {
603
599
updatedLocations [i ] = updateLocation (
604
- filters ,
605
- loc ,
606
600
matchRule ,
601
+ pathRule ,
602
+ loc ,
607
603
listenerPort ,
608
- path ,
609
- grpc ,
610
604
keepAliveCheck ,
611
605
mirrorPercentage ,
612
606
)
0 commit comments