@@ -422,7 +422,14 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
422422 case gatewayv1 .PathMatchExact :
423423 route .Uris = []string {* match .Path .Value }
424424 case gatewayv1 .PathMatchPathPrefix :
425- route .Uris = []string {* match .Path .Value + "*" }
425+ pathValue := * match .Path .Value
426+ route .Uris = []string {pathValue }
427+
428+ if strings .HasSuffix (pathValue , "/" ) {
429+ route .Uris = append (route .Uris , pathValue + "*" )
430+ } else {
431+ route .Uris = append (route .Uris , pathValue + "/*" )
432+ }
426433 case gatewayv1 .PathMatchRegularExpression :
427434 var this []adctypes.StringOrSlice
428435 this = append (this , adctypes.StringOrSlice {
@@ -439,6 +446,11 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
439446 default :
440447 return nil , errors .New ("unknown path match type " + string (* match .Path .Type ))
441448 }
449+ } else {
450+ /* If no matches are specified, the default is a prefix
451+ path match on "/", which has the effect of matching every
452+ HTTP request. */
453+ route .Uris = []string {"/" , "/*" }
442454 }
443455
444456 if len (match .Headers ) > 0 {
@@ -451,7 +463,12 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
451463 StrVal : "http_" + name ,
452464 })
453465
454- switch * header .Type {
466+ matchType := gatewayv1 .HeaderMatchExact
467+ if header .Type != nil {
468+ matchType = * header .Type
469+ }
470+
471+ switch matchType {
455472 case gatewayv1 .HeaderMatchExact :
456473 this = append (this , adctypes.StringOrSlice {
457474 StrVal : "==" ,
@@ -461,7 +478,7 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
461478 StrVal : "~~" ,
462479 })
463480 default :
464- return nil , errors .New ("unknown header match type " + string (* header . Type ))
481+ return nil , errors .New ("unknown header match type " + string (matchType ))
465482 }
466483
467484 this = append (this , adctypes.StringOrSlice {
@@ -479,7 +496,12 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
479496 StrVal : "arg_" + strings .ToLower (fmt .Sprintf ("%v" , query .Name )),
480497 })
481498
482- switch * query .Type {
499+ queryType := gatewayv1 .QueryParamMatchExact
500+ if query .Type != nil {
501+ queryType = * query .Type
502+ }
503+
504+ switch queryType {
483505 case gatewayv1 .QueryParamMatchExact :
484506 this = append (this , adctypes.StringOrSlice {
485507 StrVal : "==" ,
@@ -489,7 +511,7 @@ func (t *Translator) translateGatewayHTTPRouteMatch(match *gatewayv1.HTTPRouteMa
489511 StrVal : "~~" ,
490512 })
491513 default :
492- return nil , errors .New ("unknown query match type " + string (* query . Type ))
514+ return nil , errors .New ("unknown query match type " + string (queryType ))
493515 }
494516
495517 this = append (this , adctypes.StringOrSlice {
0 commit comments