Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 💥 support http redirections and http challenges with cert-manager #934

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,12 @@
{{- range $entrypoint, $config := $.Values.ports }}
{{- if $config }}
{{- if $config.redirectTo }}
{{- $toPort := index $.Values.ports $config.redirectTo }}
{{- $toPort := index $.Values.ports $config.redirectTo.port }}
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.to=:{{ $toPort.exposedPort }}"
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.scheme=https"
{{- if $config.redirectTo.priority }}
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.priority={{ $config.redirectTo.priority }}"
{{- end }}
{{- end }}
{{- if $config.middlewares }}
- "--entrypoints.{{ $entrypoint }}.http.middlewares={{ join "," $config.middlewares }}"
Expand Down
30 changes: 29 additions & 1 deletion traefik/tests/deployment-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,32 @@ tests:
content: "--entrypoints.websecure.http3"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.websecure.http3.advertisedPort=443"
content: "--entrypoints.websecure.http3.advertisedPort=443"
- it: should have http redirections enabled, when enabled with redirectTo
set:
ports:
web:
redirectTo:
port: websecure
websecure:
exposedPort: 443
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.to=:443"
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- it: should have http redirections enabled, when enabled with redirectTo and priority
set:
ports:
web:
redirectTo:
port: websecure
priority: 10
websecure:
exposedPort: 443
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: "--entrypoints.web.http.redirections.entryPoint.priority=10"
5 changes: 4 additions & 1 deletion traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,10 @@ ports:
# Port Redirections
# Added in 2.2, you can make permanent redirects via entrypoints.
# https://docs.traefik.io/routing/entrypoints/#redirection
# redirectTo: websecure
# redirectTo:
# port: websecure
# (Optional)
# priority: 10
#
# Trust forwarded headers information (X-Forwarded-*).
# forwardedHeaders:
Expand Down