Skip to content

Commit f22c823

Browse files
committed
redirect with 308 following nginx default
Signed-off-by: omar <omar.hammami@solo.io>
1 parent 0068d99 commit f22c823

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/i2gw/implementations/kgateway/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ The command should generate Gateway API and Kgateway resources.
5959
- `nginx.ingress.kubernetes.io/limit-burst-multiplier`
6060
- `nginx.ingress.kubernetes.io/proxy-send-timeout`
6161
- `nginx.ingress.kubernetes.io/proxy-read-timeout`
62-
- `nginx.ingress.kubernetes.io/ssl-redirect`: When set to `"true"`, adds a `RequestRedirect` filter to HTTPRoute rules that redirects HTTP to HTTPS with a 301 status code.
63-
- `nginx.ingress.kubernetes.io/force-ssl-redirect`: When set to `"true"`, adds a `RequestRedirect` filter to HTTPRoute rules that redirects HTTP to HTTPS with a 301 status code. Treated identically to `ssl-redirect`.
62+
- `nginx.ingress.kubernetes.io/ssl-redirect`: When set to `"true"`, adds a `RequestRedirect` filter to HTTPRoute rules that redirects HTTP to HTTPS with a 308 status code.
63+
- `nginx.ingress.kubernetes.io/force-ssl-redirect`: When set to `"true"`, adds a `RequestRedirect` filter to HTTPRoute rules that redirects HTTP to HTTPS with a 308 status code. Treated identically to `ssl-redirect`.
6464
- `nginx.ingress.kubernetes.io/ssl-passthrough`: When set to `"true"`, enables TLS passthrough mode. Converts the Ingress to a `TLSRoute` with a Gateway listener using `protocol: TLS` and `tls.mode: Passthrough`. The HTTPRoute that would normally be created is removed.
6565
- `nginx.ingress.kubernetes.io/use-regex`: When set to `"true"`, indicates that the paths defined on an Ingress should be treated as regular expressions.
6666
Uses host-group semantics: if any Ingress contributing rules for a given host has `use-regex: "true"`, regex-style path matching is enforced on **all**

pkg/i2gw/implementations/kgateway/ssl_redirect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func splitHTTPRouteForSSLRedirect(
118118
Type: gwv1.HTTPRouteFilterRequestRedirect,
119119
RequestRedirect: &gwv1.HTTPRequestRedirectFilter{
120120
Scheme: ptr.To("https"),
121-
StatusCode: ptr.To(301),
121+
StatusCode: ptr.To(308),
122122
},
123123
},
124124
)

pkg/i2gw/implementations/kgateway/testing/testdata/output/ssl_redirect.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
- filters:
5757
- requestRedirect:
5858
scheme: https
59-
statusCode: 301
59+
statusCode: 308
6060
type: RequestRedirect
6161
matches:
6262
- path:
@@ -106,7 +106,7 @@ spec:
106106
- filters:
107107
- requestRedirect:
108108
scheme: https
109-
statusCode: 301
109+
statusCode: 308
110110
type: RequestRedirect
111111
matches:
112112
- path:
@@ -115,7 +115,7 @@ spec:
115115
- filters:
116116
- requestRedirect:
117117
scheme: https
118-
statusCode: 301
118+
statusCode: 308
119119
type: RequestRedirect
120120
matches:
121121
- path:
@@ -124,7 +124,7 @@ spec:
124124
- filters:
125125
- requestRedirect:
126126
scheme: https
127-
statusCode: 301
127+
statusCode: 308
128128
type: RequestRedirect
129129
matches:
130130
- path:

pkg/i2gw/providers/ingressnginx/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ The ingress-nginx provider currently supports translating the following annotati
132132

133133
### SSL Redirect
134134

135-
- `nginx.ingress.kubernetes.io/ssl-redirect`: When set to `"true"`, enables SSL redirect for HTTP requests. For the Kgateway implementation, this maps to a `RequestRedirect` filter on HTTPRoute rules that redirects HTTP to HTTPS with a 301 status code.
135+
- `nginx.ingress.kubernetes.io/ssl-redirect`: When set to `"true"`, enables SSL redirect for HTTP requests. For the Kgateway implementation, this maps to a `RequestRedirect` filter on HTTPRoute rules that redirects HTTP to HTTPS with a 308 status code.
136136

137-
- `nginx.ingress.kubernetes.io/force-ssl-redirect`: When set to `"true"`, enables SSL redirect for HTTP requests. This annotation is treated exactly the same as `ssl-redirect`. For the Kgateway implementation, this maps to a `RequestRedirect` filter on HTTPRoute rules that redirects HTTP to HTTPS with a 301 status code.
137+
- `nginx.ingress.kubernetes.io/force-ssl-redirect`: When set to `"true"`, enables SSL redirect for HTTP requests. This annotation is treated exactly the same as `ssl-redirect`. For the Kgateway implementation, this maps to a `RequestRedirect` filter on HTTPRoute rules that redirects HTTP to HTTPS with a 308 status code.
138138

139139
**Note:** Both annotations are supported and treated identically. If either annotation is set to `"true"` (case-insensitive), SSL redirect will be enabled. The redirect filter is added at the rule level in the HTTPRoute, redirecting all HTTP traffic to HTTPS.
140140

0 commit comments

Comments
 (0)