From 1a2d02c37c5a51aefb508d8223d55f8871d8dc72 Mon Sep 17 00:00:00 2001 From: Chakrit Wichian Date: Fri, 26 Jul 2024 14:24:31 +0700 Subject: [PATCH] docs: Clarify from-to-www redirect direction. This was not clear to me when reading the docs whether the ingress will redirect from non-www to with-www or the reverse. It's also not very clear from just grepping around the codebase. I found the answer by reading from this reddit link: https://www.reddit.com/r/kubernetes/comments/pbl033/k8s_ingress_redirecting_www_to_nonwww_domains/ So, to save time for other people doing the same, which I assumes is a lot of people since it's a common scenario, this little revision in the docs is warranted. --- docs/user-guide/nginx-configuration/annotations.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/nginx-configuration/annotations.md b/docs/user-guide/nginx-configuration/annotations.md index 180592574..68ddb2fa2 100755 --- a/docs/user-guide/nginx-configuration/annotations.md +++ b/docs/user-guide/nginx-configuration/annotations.md @@ -638,7 +638,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. +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. + To enable this feature use the annotation `nginx.ingress.kubernetes.io/from-to-www-redirect: "true"` !!! attention