File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
- map $http_host $redir_to {
1
+ map $host$request_uri $redir_to {
2
2
default "not-found";
3
- {{- range $shost, $dhost := .Values.redirects }}
4
- {{ $shost }} {{ quote $dhost }};
3
+ {{- range $src, $dst := .Values.redirects }}
4
+ {{- if hasPrefix "^" $src }}
5
+ {{ printf "~%s" $src }} {{ quote $dst }};
6
+ {{- end }}
7
+ {{- end }}
8
+ }
9
+
10
+ map $host $redir_host_to {
11
+ default "not-found";
12
+ {{- range $src, $dst := .Values.redirects }}
13
+ {{- if not (hasPrefix "^" $src) }}
14
+ {{ quote $src }} {{ quote $dst }};
15
+ {{- end }}
5
16
{{- end }}
6
17
}
7
18
@@ -10,12 +21,14 @@ server {
10
21
server_name localhost default_server;
11
22
12
23
location / {
13
- if ($redir_to = "not-found") {
14
- add_header Content/Type text/plain;
24
+ if ($redir_to != "not-found") {
25
+ return 301 $redir_to;
26
+ }
15
27
16
- return 404;
28
+ if ($redir_host_to != "not-found") {
29
+ return 301 $redir_host_to;
17
30
}
18
31
19
- return 301 $redir_to ;
32
+ return 404 ;
20
33
}
21
34
}
Original file line number Diff line number Diff line change 1
1
redirects : {}
2
2
# redirect.host: https://redirect/url
3
+ # ^redirect.host/path$: https://redirect/url
3
4
4
5
nameOverride : " "
5
6
fullnameOverride : " "
@@ -24,4 +25,4 @@ ingress:
24
25
25
26
annotations : {}
26
27
hosts : []
27
- tls : {}
28
+ tls : []
You can’t perform that action at this time.
0 commit comments