Skip to content

Commit 9522d70

Browse files
authored
redirects: release new chart using rewrite-target (#193)
It seems like since we updated nginx (presumably a long time ago) the previous `snippets` call became considered a `Critial` level risk and therefore was disabled[0] by default. This broke our status page redirects. We should move to an alternative redirect solution[1] This alternative always uses 302 http code so we must remove that option for configuration. [0] https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations-risk/ [1] https://medium.com/@megaurav25/url-redirection-with-full-url-path-preservation-using-ingress-nginx-493f18523c99 Bug: T390071
1 parent f85ff02 commit 9522d70

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

charts/redirects/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: redirects
33
description: Create ingresses for redirecting subdomains elsewhere
44
type: application
5-
version: 1.0.0
5+
version: 2.0.0
66
appVersion: "1.0.0"
77
maintainers:
88
- name: WBstack

charts/redirects/templates/ingresses.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ kind: Ingress
55
metadata:
66
name: redirect-ingress-{{ .host }}
77
annotations:
8-
nginx.ingress.kubernetes.io/server-snippet: |
9-
return {{ .statusCode }} {{ .toLocation }}$request_uri;
8+
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
9+
nginx.ingress.kubernetes.io/rewrite-target: {{ .toLocation }}/$1
1010
spec:
1111
ingressClassName: nginx
1212
rules:

charts/redirects/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
redirects:
22
- host: example.com
33
toLocation: https://example.net
4-
statusCode: 302
54
tlsName: tls-example-secret

0 commit comments

Comments
 (0)