Skip to content

Conversation

@davidwin93
Copy link
Contributor

@davidwin93 davidwin93 commented May 29, 2025

What type of PR is this?
/kind bug
/area conformance-test

What this PR does / why we need it:

This PR allows users to select either a 303, 307 or 308 status code along with the existing options of 301 and 302. This matches RFC 9110 and by letting users select 308 it will match the existing nginx ingress behaviour of using a 308 for HTTP -> HTTPS redirects.

Which issue(s) this PR fixes:

Fixes #2748

Does this PR introduce a user-facing change?:
This will allow users to select 303,307 or 308 as redirect status codes along with 301 and 302.

Adds support to select 303,307 or 308 status codes along with the current options of 301 and 302

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. area/conformance-test Issues or PRs related to Conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 29, 2025
@k8s-ci-robot k8s-ci-robot requested review from Xunzhuo and mlavacca May 29, 2025 01:47
@k8s-ci-robot
Copy link
Contributor

Welcome @davidwin93!

It looks like this is your first PR to kubernetes-sigs/gateway-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 29, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @davidwin93. 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.

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.

@robscott
Copy link
Member

Thanks @davidwin93, this will be a great improvement!

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 30, 2025
@davidwin93 davidwin93 force-pushed the Add-3xx-Support branch 3 times, most recently from 22fe26d to b5bf3dc Compare May 31, 2025 04:54
@davidwin93 davidwin93 changed the title [WIP] Add 307 / 308 Redirect Status Code Support Add 307 / 308 Redirect Status Code Support May 31, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 31, 2025
@LiorLieberman
Copy link
Member

/cc

@mikemorris
Copy link
Contributor

mikemorris commented Jun 3, 2025

Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) or 308 (Permanent Redirect) status code can be used instead.

Is there any suggestion that we would want to include in docs for this behavior for 301 and 302 responses?

@kflynn
Copy link
Contributor

kflynn commented Jun 3, 2025

I'd like to see the user-facing docs updated as part of this PR -- thanks!!

Copy link
Member

@LiorLieberman LiorLieberman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echoing feedback from today's community meeting.

this may benefit from a SupportedFeature for gradual enablement, because if this gets in, if there is any implementation that does not support 307 and 308 they go out of conformance

@davidwin93
Copy link
Contributor Author

@LiorLieberman in regards to SupportedFeature do I need to wait for this to get in first?
Do you happen to have any examples of any in flight work that is currently using this functionality, or would this be the first change to leverage supported features?

@candita
Copy link
Contributor

candita commented Jun 3, 2025

this may benefit from a SupportedFeature for gradual enablement, because if this gets in, if there is any implementation that does not support 307 and 308 they go out of conformance

Can we add this as Extended (optional)?

@LiorLieberman
Copy link
Member

@LiorLieberman in regards to SupportedFeature do I need to wait for this to get in first? Do you happen to have any examples of any in flight work that is currently using this functionality, or would this be the first change to leverage supported features?

no, these are two different things. when I said supported features I really meant a FeatureName - like https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/tests/httproute-response-header-modifier.go#L40 for example.

And @candita, to your point, adding a featureName would mean it is initially extended, but as said during the meeting, we should communicate clearly we are only doing it for gradual enablement, with intentions to move it to core (and remove the featureName) once we communicated it enough

@youngnick youngnick removed the kind/bug Categorizes issue or PR as related to a bug. label Jun 4, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2025
@davidwin93
Copy link
Contributor Author

@LiorLieberman this should be good for another pass. I believe I've addressed the comments correctly.

// This option indicates support for HTTPRoute additional redirect status code 303 (extended conformance)
SupportHTTPRoute303RedirectStatusCode FeatureName = "HTTPRoute303RedirectStatusCode"

// This option indicates support for HTTPRoute additional redirect status code 303 (extended conformance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the comment of this and next feature (they are all still with code 303)

@rikatz
Copy link
Member

rikatz commented Oct 10, 2025

do we have some implementation already supporting these return codes, just so we can do a run and guarantee that conformance is also ok?

Thanks!

@josh-pritchard
Copy link

Thanks everyone for the work and discussion on this. I completely understand why this has taken some time to make it in, and also why it didn't make the most recent release. These things happen, and the process around release management and validation criteria is important to keep stable.

That said, I do want to highlight a concern from the perspective of downstream adopters and integrators. When changes like this can't make it into a patch or minor release—even when they're relatively small, such as expanding an enum or adding a bit of CEL validation—it effectively means that these improvements can take close to a year to reach users, given the six-month release cadence.

That long gap can make it difficult for projects building on Gateway API to support their users or align on conformance, especially when a missing option or validation rule blocks certain use cases. Over time, this can lead to the same challenges that the Ingress API experienced, where implementations resorted to annotations or custom extensions to fill gaps that the upstream API couldn't evolve quickly enough to cover. You can see in the reference above where we have moved to do exactly that in kgateway due to this not merging and that given prior discussion here our understanding is that changes like this can only go in minor versions.

For those reasons, I'd like to suggest we re-evaluate how we classify and handle changes like this. It seems like there should be a safe path for small, backward-compatible improvements to land in patch releases, especially when they improve expressiveness or correctness without changing behavior or compliance.

Really appreciate everyone's continued work here; I just want to make sure Gateway API can keep evolving fast enough to stay broadly usable across the ecosystem.

@kflynn
Copy link
Contributor

kflynn commented Oct 14, 2025

This is part of the point of the changes discussed in #4164 -- the idea is that yes, it should be faster to get things into an experimental-channel release that people can experiment with.

@josh-pritchard
Copy link

josh-pritchard commented Oct 14, 2025

Thanks @kflynn! A very timely discussion, from a skim I think moving to a model of monthly releases for the experimental channel makes a lot of sense. To make sure I understand correctly, in the context of this PR where there is an agreed upon change that should be made to the stable & experimental versions simultaneously, it just means that the changes would be available at most within a month of merging via the experimental channel? Then they will be in the next stable release whenever that happens?

@robscott
Copy link
Member

That said, I do want to highlight a concern from the perspective of downstream adopters and integrators. When changes like this can't make it into a patch or minor release—even when they're relatively small, such as expanding an enum or adding a bit of CEL validation—it effectively means that these improvements can take close to a year to reach users, given the six-month release cadence.

You're completely right, this took too long to get in. Improving this is a big focus for us, a big thanks to @kflynn for helping move this forward.

@robscott
Copy link
Member

There was some concern if this was too late to squeeze in before v1.4, but now that that release is out, I think it's past time to get this change in.

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davidwin93!

/lgtm
/approve

}

var MeshHTTPRoute303Redirect = suite.ConformanceTest{
ShortName: "MeshHTTPRoute303Redirect",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidwin93 Do you mind filing a follow up issue to migrate these tests to reuse more code?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidwin93, robscott

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

The pull request process is described here

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 14, 2025
@k8s-ci-robot k8s-ci-robot merged commit a80406e into kubernetes-sigs:main Oct 14, 2025
8 checks passed
@kflynn
Copy link
Contributor

kflynn commented Oct 15, 2025

I agree that this is a fine candidate for the next release! @davidwin93, one major upcoming change is that you need to line up some implementations who're willing to implement this as an experimental feature, although we, uh, haven't decided exactly how to record that. A comment here will do for now. 🙂

@howardjohn
Copy link
Contributor

Istio and kgateway implement this experimental feature now.

tylerauerbeck pushed a commit to tylerauerbeck/gateway-api that referenced this pull request Nov 27, 2025
* add support for 303 status and split 307/308 into seperate features

* add tests for 303 redirect

* split 307 and 308 redirect features

* update documentation to cover 303,307,308 status codes

* add redirect status codes to httproute crd enum

* update conformance tests to focus only on status code validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance-test Issues or PRs related to Conformance tests. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Gateway API validations too strict for redirect status codes