'@file' 是用来引用中间件配置文件的。如果你想使用它,需要在 Traefik 的配置文件中定义中间件,并将它们保存到文件中。然后,在路由规则中使用 '@file' 来引用这些中间件。

例如,你可以在 Traefik 的配置文件中定义一个名为 'https-redirect' 的中间件,如下所示:

[http.middlewares]
  [http.middlewares.https-redirect.redirectScheme]
    scheme = "https"

然后,将此中间件保存到文件 /path/to/middleware/https-redirect.toml 中。最后,在路由规则中使用 '@file' 来引用此文件中的中间件,如下所示:

traefik.http.routers.traefik-dash-default.middlewares=https-redirect@file:/path/to/middleware/https-redirect.toml

这将使 Traefik 从文件中加载 'https-redirect' 中间件,并将其应用于路由规则 'traefik-dash-default'。

Traefik 中间件配置文件:@file 的使用和定义

原文地址: https://www.cveoy.top/t/topic/mF9M 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录