From 35ba3afb839369cf13f3cdb1f809e6a53862afb7 Mon Sep 17 00:00:00 2001 From: Marco Ebert Date: Sat, 27 Jul 2024 06:52:00 +0200 Subject: [PATCH] Docs: Implement suggestion. --- docs/user-guide/nginx-configuration/annotations.md | 5 +++-- internal/ingress/annotations/redirect/redirect.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/user-guide/nginx-configuration/annotations.md b/docs/user-guide/nginx-configuration/annotations.md index 68e7fff74..f90e87868 100755 --- a/docs/user-guide/nginx-configuration/annotations.md +++ b/docs/user-guide/nginx-configuration/annotations.md @@ -655,8 +655,9 @@ To preserve the trailing slash in the URI with `ssl-redirect`, set `nginx.ingres ### Redirect from/to www -In some scenarios 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. +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. + +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"` diff --git a/internal/ingress/annotations/redirect/redirect.go b/internal/ingress/annotations/redirect/redirect.go index b58e35171..e774b2fe8 100644 --- a/internal/ingress/annotations/redirect/redirect.go +++ b/internal/ingress/annotations/redirect/redirect.go @@ -51,7 +51,7 @@ var redirectAnnotations = parser.Annotation{ Validator: parser.ValidateBool, Scope: parser.AnnotationScopeLocation, 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: { Validator: parser.ValidateRegex(parser.URLIsValidRegex, false),