【发布时间】:2021-09-12 12:22:41
【问题描述】:
我试图在相关帖子中找到答案,但我找不到。
我创建了一个本地插件并以这种方式配置它:
traefik.toml
[experimental.localPlugins.myplugin]
moduleName = "test.com/traefik/myplugin"
.traefik.yml
displayName: Do some stuff
type: middleware
import: test.com/traefik/myplugin
summary:do a lot of nice stuffs
testData:
Headers:
Foo: Bar
我可以在日志中看到插件已加载:
Static configuration loaded {"global":{"checkNewVersion":true},"serversTransport":{"maxIdleConnsPerHost":200},"entryPoints":{"http":{"address":":80","transport":{"lifeCycle":{"graceTimeOut":"10s"},"respondingTimeouts":{"idleTimeout":"3m0s"}},"forwardedHeaders":{},"http":{},"udp":{"timeout":"3s"}},"traefik":{"address":":8080","transport":{"lifeCycle":{"graceTimeOut":"10s"},"respondingTimeouts":{"idleTimeout":"3m0s"}},"forwardedHeaders":{},"http":{},"udp":{"timeout":"3s"}}},"providers":{"providersThrottleDuration":"2s","docker":{"watch":true,"endpoint":"unix:///var/run/docker.sock","defaultRule":"Host(`{{ normalize .Name }}`)","exposedByDefault":true,"swarmModeRefreshSeconds":"15s"}},"api":{"insecure":true,"dashboard":true},"ping":{"entryPoint":"http","terminatingStatusCode":503},"log":{"level":"DEBUG","format":"common"},"accessLog":{"format":"json","filters":{},"fields":{"defaultMode":"keep","headers":{"defaultMode":"drop"}}},"pilot":{"dashboard":true}**,"experimental":{"localPlugins":{"myplugin":{"moduleName":"test.com/traefik/myplugin"}}}}
但是当我尝试这样使用它时:
traefik.http.routers.myrouter.middlewares="testplugin-myplugin"
或
traefik.http.routers.myrouter.middlewares="myplugin"
我收到如下错误:
middleware "testplugin-mypluginn@docker" does not exist
我正在使用 Traefik 2.5.2 docker image> 我尝试了一些静态和动态值的组合,但没有运气:(我正在使用 Traefik 2.5.2 docker image。我尝试了一些静态和动态值的组合,但没有运气:(我错过了一些配置吗?
【问题讨论】:
标签: middleware traefik