Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Clarify from-to-www redirect direction. #11692

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/user-guide/nginx-configuration/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,10 @@ 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, 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"`

!!! attention
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/annotations/redirect/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down