diff --git a/cmd/plugin/lints/ingress.go b/cmd/plugin/lints/ingress.go index 3515c32729..a9c9674f8b 100644 --- a/cmd/plugin/lints/ingress.go +++ b/cmd/plugin/lints/ingress.go @@ -78,9 +78,24 @@ func GetIngressLints() []IngressLint { message: "Contains an annotation with the prefix 'nginx.com'. This is a prefix for https://github.com/nginxinc/kubernetes-ingress", f: annotationPrefixIsNginxCom, }, + { + message: "The x-forwarded-prefix annotation value is a boolean instead of a string", + issue: 3786, + version: "0.24.0", + f: xForwardedPrefixIsBool, + }, } } +func xForwardedPrefixIsBool(ing v1beta1.Ingress) bool { + for name, val := range ing.Annotations { + if strings.HasSuffix(name, "/x-forwarded-prefix") && (val == "true" || val == "false") { + return true + } + } + return false +} + func annotationPrefixIsNginxCom(ing v1beta1.Ingress) bool { for name := range ing.Annotations { if strings.HasPrefix(name, "nginx.com/") {