Docs: Implement suggestion.

This commit is contained in:
Marco Ebert 2024-07-27 06:52:00 +02:00 committed by k8s-infra-cherrypick-robot
parent a2af07ba18
commit 35ba3afb83
2 changed files with 4 additions and 3 deletions

View file

@ -655,8 +655,9 @@ To preserve the trailing slash in the URI with `ssl-redirect`, set `nginx.ingres
### Redirect from/to www ### Redirect from/to www
In some scenarios is required to redirect from `www.domain.com` to `domain.com` or vice versa, In some scenarios, it is required to redirect from `www.domain.com` to `domain.com` or vice versa, which way the redirect is performed depends on the configured `host` value in the Ingress object.
which way the redirect is performed depends on the configured `host` value in the Ingress object.
For example, if `.spec.rules.host` is configured with a value like `www.example.com`, then this annotation will redirect to `example.com`. If `.spec.rules.host` is configured with a value like `example.com`, so without a `www`, then this annotation will redirect to `www.example.com` instead.
To enable this feature use the annotation `nginx.ingress.kubernetes.io/from-to-www-redirect: "true"` To enable this feature use the annotation `nginx.ingress.kubernetes.io/from-to-www-redirect: "true"`

View file

@ -51,7 +51,7 @@ var redirectAnnotations = parser.Annotation{
Validator: parser.ValidateBool, Validator: parser.ValidateBool,
Scope: parser.AnnotationScopeLocation, Scope: parser.AnnotationScopeLocation,
Risk: parser.AnnotationRiskLow, // Low, as it allows just a set of options Risk: parser.AnnotationRiskLow, // Low, as it allows just a set of options
Documentation: `In some scenarios is required to redirect from www.domain.com to domain.com or vice versa. To enable this feature use this annotation.`, Documentation: `In some scenarios, it is required to redirect from www.domain.com to domain.com or vice versa, which way the redirect is performed depends on the configured host value in the Ingress object.`,
}, },
temporalRedirectAnnotation: { temporalRedirectAnnotation: {
Validator: parser.ValidateRegex(parser.URLIsValidRegex, false), Validator: parser.ValidateRegex(parser.URLIsValidRegex, false),