Skip to content

Commit bb5a778

Browse files
committed
Add nginx.org/http-redirect-code annotation and ConfigMap support
- Add ConfigMap option to set default HTTP redirect code globally - Add nginx.org/http-redirect-code annotation for per-Ingress override - Support redirect codes 301, 302, 307, 308 with validation - Annotation requires ssl-redirect or redirect-to-https to be enabled - Add k8s validation for annotation format checking - Update NGINX templates to use configurable redirect code Signed-off-by: Haywood Shannon <[email protected]>
1 parent 26e208b commit bb5a778

23 files changed

+621
-57
lines changed

config/crd/bases/k8s.nginx.org_virtualserverroutes.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ spec:
178178
properties:
179179
code:
180180
description: 'The status code of a redirect. The allowed
181-
values are: 301, 302, 307 or 308. The default is 301.'
181+
values are: 301, 302, 307 or 308. The default follows
182+
the ConfigMap http-redirect-code setting, which defaults
183+
to 301.'
182184
type: integer
183185
url:
184186
description: 'The URL to redirect the request to. Supported
@@ -243,8 +245,9 @@ spec:
243245
properties:
244246
code:
245247
description: 'The status code of a redirect. The allowed
246-
values are: 301, 302, 307 or 308. The default is
247-
301.'
248+
values are: 301, 302, 307 or 308. The default follows
249+
the ConfigMap http-redirect-code setting, which
250+
defaults to 301.'
248251
type: integer
249252
url:
250253
description: 'The URL to redirect the request to.
@@ -400,7 +403,8 @@ spec:
400403
code:
401404
description: 'The status code of a redirect. The
402405
allowed values are: 301, 302, 307 or 308. The
403-
default is 301.'
406+
default follows the ConfigMap http-redirect-code
407+
setting, which defaults to 301.'
404408
type: integer
405409
url:
406410
description: 'The URL to redirect the request
@@ -585,7 +589,9 @@ spec:
585589
code:
586590
description: 'The status code of a redirect.
587591
The allowed values are: 301, 302, 307
588-
or 308. The default is 301.'
592+
or 308. The default follows the ConfigMap
593+
http-redirect-code setting, which defaults
594+
to 301.'
589595
type: integer
590596
url:
591597
description: 'The URL to redirect the request
@@ -783,7 +789,8 @@ spec:
783789
code:
784790
description: 'The status code of a redirect. The
785791
allowed values are: 301, 302, 307 or 308. The
786-
default is 301.'
792+
default follows the ConfigMap http-redirect-code
793+
setting, which defaults to 301.'
787794
type: integer
788795
url:
789796
description: 'The URL to redirect the request

config/crd/bases/k8s.nginx.org_virtualservers.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ spec:
265265
properties:
266266
code:
267267
description: 'The status code of a redirect. The allowed
268-
values are: 301, 302, 307 or 308. The default is 301.'
268+
values are: 301, 302, 307 or 308. The default follows
269+
the ConfigMap http-redirect-code setting, which defaults
270+
to 301.'
269271
type: integer
270272
url:
271273
description: 'The URL to redirect the request to. Supported
@@ -330,8 +332,9 @@ spec:
330332
properties:
331333
code:
332334
description: 'The status code of a redirect. The allowed
333-
values are: 301, 302, 307 or 308. The default is
334-
301.'
335+
values are: 301, 302, 307 or 308. The default follows
336+
the ConfigMap http-redirect-code setting, which
337+
defaults to 301.'
335338
type: integer
336339
url:
337340
description: 'The URL to redirect the request to.
@@ -487,7 +490,8 @@ spec:
487490
code:
488491
description: 'The status code of a redirect. The
489492
allowed values are: 301, 302, 307 or 308. The
490-
default is 301.'
493+
default follows the ConfigMap http-redirect-code
494+
setting, which defaults to 301.'
491495
type: integer
492496
url:
493497
description: 'The URL to redirect the request
@@ -672,7 +676,9 @@ spec:
672676
code:
673677
description: 'The status code of a redirect.
674678
The allowed values are: 301, 302, 307
675-
or 308. The default is 301.'
679+
or 308. The default follows the ConfigMap
680+
http-redirect-code setting, which defaults
681+
to 301.'
676682
type: integer
677683
url:
678684
description: 'The URL to redirect the request
@@ -870,7 +876,8 @@ spec:
870876
code:
871877
description: 'The status code of a redirect. The
872878
allowed values are: 301, 302, 307 or 308. The
873-
default is 301.'
879+
default follows the ConfigMap http-redirect-code
880+
setting, which defaults to 301.'
874881
type: integer
875882
url:
876883
description: 'The URL to redirect the request

deploy/crds.yaml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,9 @@ spec:
13681368
properties:
13691369
code:
13701370
description: 'The status code of a redirect. The allowed
1371-
values are: 301, 302, 307 or 308. The default is 301.'
1371+
values are: 301, 302, 307 or 308. The default follows
1372+
the ConfigMap http-redirect-code setting, which defaults
1373+
to 301.'
13721374
type: integer
13731375
url:
13741376
description: 'The URL to redirect the request to. Supported
@@ -1433,8 +1435,9 @@ spec:
14331435
properties:
14341436
code:
14351437
description: 'The status code of a redirect. The allowed
1436-
values are: 301, 302, 307 or 308. The default is
1437-
301.'
1438+
values are: 301, 302, 307 or 308. The default follows
1439+
the ConfigMap http-redirect-code setting, which
1440+
defaults to 301.'
14381441
type: integer
14391442
url:
14401443
description: 'The URL to redirect the request to.
@@ -1590,7 +1593,8 @@ spec:
15901593
code:
15911594
description: 'The status code of a redirect. The
15921595
allowed values are: 301, 302, 307 or 308. The
1593-
default is 301.'
1596+
default follows the ConfigMap http-redirect-code
1597+
setting, which defaults to 301.'
15941598
type: integer
15951599
url:
15961600
description: 'The URL to redirect the request
@@ -1775,7 +1779,9 @@ spec:
17751779
code:
17761780
description: 'The status code of a redirect.
17771781
The allowed values are: 301, 302, 307
1778-
or 308. The default is 301.'
1782+
or 308. The default follows the ConfigMap
1783+
http-redirect-code setting, which defaults
1784+
to 301.'
17791785
type: integer
17801786
url:
17811787
description: 'The URL to redirect the request
@@ -1973,7 +1979,8 @@ spec:
19731979
code:
19741980
description: 'The status code of a redirect. The
19751981
allowed values are: 301, 302, 307 or 308. The
1976-
default is 301.'
1982+
default follows the ConfigMap http-redirect-code
1983+
setting, which defaults to 301.'
19771984
type: integer
19781985
url:
19791986
description: 'The URL to redirect the request
@@ -2692,7 +2699,9 @@ spec:
26922699
properties:
26932700
code:
26942701
description: 'The status code of a redirect. The allowed
2695-
values are: 301, 302, 307 or 308. The default is 301.'
2702+
values are: 301, 302, 307 or 308. The default follows
2703+
the ConfigMap http-redirect-code setting, which defaults
2704+
to 301.'
26962705
type: integer
26972706
url:
26982707
description: 'The URL to redirect the request to. Supported
@@ -2757,8 +2766,9 @@ spec:
27572766
properties:
27582767
code:
27592768
description: 'The status code of a redirect. The allowed
2760-
values are: 301, 302, 307 or 308. The default is
2761-
301.'
2769+
values are: 301, 302, 307 or 308. The default follows
2770+
the ConfigMap http-redirect-code setting, which
2771+
defaults to 301.'
27622772
type: integer
27632773
url:
27642774
description: 'The URL to redirect the request to.
@@ -2914,7 +2924,8 @@ spec:
29142924
code:
29152925
description: 'The status code of a redirect. The
29162926
allowed values are: 301, 302, 307 or 308. The
2917-
default is 301.'
2927+
default follows the ConfigMap http-redirect-code
2928+
setting, which defaults to 301.'
29182929
type: integer
29192930
url:
29202931
description: 'The URL to redirect the request
@@ -3099,7 +3110,9 @@ spec:
30993110
code:
31003111
description: 'The status code of a redirect.
31013112
The allowed values are: 301, 302, 307
3102-
or 308. The default is 301.'
3113+
or 308. The default follows the ConfigMap
3114+
http-redirect-code setting, which defaults
3115+
to 301.'
31033116
type: integer
31043117
url:
31053118
description: 'The URL to redirect the request
@@ -3297,7 +3310,8 @@ spec:
32973310
code:
32983311
description: 'The status code of a redirect. The
32993312
allowed values are: 301, 302, 307 or 308. The
3300-
default is 301.'
3313+
default follows the ConfigMap http-redirect-code
3314+
setting, which defaults to 301.'
33013315
type: integer
33023316
url:
33033317
description: 'The URL to redirect the request

0 commit comments

Comments
 (0)