根据https://github.com/containous/traefik/pull/2133,应该可以选择性地重新定向每个前端。这在File后端可用吗?
我尝试添加以下内容,但它不起作用:
[frontends.foo.headers]
SSLRedirect = true
答案 0 :(得分:0)
选项SSLRedirect = true
始终在443上重定向。
如果要在不使用443端口的情况下重定向到入口点,请使用entryPoint = "https"
https://docs.traefik.io/user-guide/examples/#http-redirect-on-https
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "examples/traefik.crt"
keyFile = "examples/traefik.key"
https://docs.traefik.io/configuration/backends/file/
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
# ...
[entryPoints.https]
address = ":443"
# ...
[file]
[frontends]
[frontends.frontend1]
backend = "backend1"
[frontends.frontend1.redirect]
entryPoint = "https"
# ...