Skip to content

feat(ingressnginx): implement redirect annotation support#316

Closed
asklokesh wants to merge 1 commit intokubernetes-sigs:mainfrom
asklokesh:fix/redirect-annotations-268
Closed

feat(ingressnginx): implement redirect annotation support#316
asklokesh wants to merge 1 commit intokubernetes-sigs:mainfrom
asklokesh:fix/redirect-annotations-268

Conversation

@asklokesh
Copy link
Copy Markdown

Summary

  • Add support for nginx-ingress redirect annotations
  • permanent-redirect with optional permanent-redirect-code (default 301)
  • temporal-redirect (default 302)
  • force-ssl-redirect enables SSL redirect even without TLS configuration
  • Validates port range (1-65535)
  • Warns when query string/fragment in redirect URL will be ignored (Gateway API limitation)

Test plan

  • Added unit tests for createRedirectFilter with various URL formats
  • Added unit tests for redirectFeature feature parser
  • Added test for force-ssl-redirect annotation
  • Added test for invalid port validation
  • All existing tests pass

Fixes #268

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 24, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Jan 24, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: asklokesh / name: Lokesh Mure (5c8e329)

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: asklokesh
Once this PR has been reviewed and has the lgtm label, please assign stevenjin8 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from rikatz January 24, 2026 21:00
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 24, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @asklokesh. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 24, 2026
@asklokesh asklokesh force-pushed the fix/redirect-annotations-268 branch from 6dc8d5d to 7cc2475 Compare January 24, 2026 21:14
Add support for nginx-ingress redirect annotations:
- permanent-redirect with permanent-redirect-code
- temporal-redirect
- force-ssl-redirect (SSL redirect without TLS configured)

Features:
- Parse redirect URLs and convert to Gateway API HTTPRequestRedirectFilter
- Validate port range (1-65535)
- Warn when query string/fragment in URL will be ignored
- Support custom redirect status codes (300-399)

Related to kubernetes-sigs#268
@asklokesh asklokesh force-pushed the fix/redirect-annotations-268 branch from 7cc2475 to 5c8e329 Compare January 24, 2026 21:23
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 24, 2026
@asklokesh
Copy link
Copy Markdown
Author

/easycla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 24, 2026
@jgreeer
Copy link
Copy Markdown
Contributor

jgreeer commented Jan 26, 2026

Hey @asklokesh, I have an PR open for nginx.ingress.kubernetes.io/permanent-redirect and nginx.ingress.kubernetes.io/temporal-redirect here. The status codes won't be supported until gwapi v1.5, so we'd either want to wait to merge or emit a warning for those. I don't parse nginx.ingress.kubernetes.io/force-ssl-redirect so you could keep this PR for that.

@asklokesh
Copy link
Copy Markdown
Author

asklokesh commented Jan 27, 2026

Closing this PR as there is already an existing PR #299 by @jgreeer that implements redirect annotations (permanent-redirect and temporal-redirect). The force-ssl-redirect annotation was already implemented in PR #290.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ingress NGINX] Support Redirect

3 participants