Træfik文件后端的每个前端是否可以配置HTTP到HTTPS重定向?

时间:2018-04-27 12:07:40

标签: traefik

根据https://github.com/containous/traefik/pull/2133,应该可以选择性地重新定向每个前端。这在File后端可用吗?

我尝试添加以下内容,但它不起作用: [frontends.foo.headers] SSLRedirect = true

1 个答案:

答案 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"

# ...