Skip to content

Commit

Permalink
Update HTTPRequestRedirectPolicy StatusCode
Browse files Browse the repository at this point in the history
Use RedirectResponseCode instead of just 301/302 for HTTPRequestRedirectPolicy StatusCode

Fixes projectcontour#6788

Signed-off-by: Billy Schulze <[email protected]>
  • Loading branch information
billyjs committed Nov 26, 2024
1 parent d05f43a commit 4af6a40
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 4 deletions.
3 changes: 1 addition & 2 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,7 @@ type HTTPRequestRedirectPolicy struct {
// StatusCode is the HTTP status code to be used in response.
// +optional
// +kubebuilder:default=302
// +kubebuilder:validation:Enum=301;302
StatusCode *int `json:"statusCode,omitempty"`
StatusCode *RedirectResponseCode `json:"statusCode,omitempty"`

// Path allows for redirection to a different path from the
// original on the request. The path must start with a
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/6789-billyjs-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use RedirectResponseCode instead of just 301/302 for HTTPRequestRedirectPolicy StatusCode
4 changes: 4 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6632,6 +6632,10 @@ spec:
enum:
- 301
- 302
- 303
- 307
- 308
format: int32
type: integer
type: object
responseHeadersPolicy:
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6852,6 +6852,10 @@ spec:
enum:
- 301
- 302
- 303
- 307
- 308
format: int32
type: integer
type: object
responseHeadersPolicy:
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6643,6 +6643,10 @@ spec:
enum:
- 301
- 302
- 303
- 307
- 308
format: int32
type: integer
type: object
responseHeadersPolicy:
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6668,6 +6668,10 @@ spec:
enum:
- 301
- 302
- 303
- 307
- 308
format: int32
type: integer
type: object
responseHeadersPolicy:
Expand Down
4 changes: 4 additions & 0 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6852,6 +6852,10 @@ spec:
enum:
- 301
- 302
- 303
- 307
- 308
format: int32
type: integer
type: object
responseHeadersPolicy:
Expand Down
7 changes: 5 additions & 2 deletions site/content/docs/main/config/api-reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,9 @@ <h3 id="projectcontour.io/v1.HTTPRequestRedirectPolicy">HTTPRequestRedirectPolic
<code>statusCode</code>
<br>
<em>
int
<a href="#projectcontour.io/v1.RedirectResponseCode">
RedirectResponseCode
</a>
</em>
</td>
<td>
Expand Down Expand Up @@ -3085,7 +3087,8 @@ <h3 id="projectcontour.io/v1.RedirectResponseCode">RedirectResponseCode
(<code>uint32</code> alias)</p></h3>
<p>
(<em>Appears on:</em>
<a href="#projectcontour.io/v1.HTTPInternalRedirectPolicy">HTTPInternalRedirectPolicy</a>)
<a href="#projectcontour.io/v1.HTTPInternalRedirectPolicy">HTTPInternalRedirectPolicy</a>,
<a href="#projectcontour.io/v1.HTTPRequestRedirectPolicy">HTTPRequestRedirectPolicy</a>)
</p>
<p>
<p>RedirectResponseCode is a uint32 type alias with validation to ensure that the value is valid.</p>
Expand Down

0 comments on commit 4af6a40

Please sign in to comment.