[英]How to configure traefik authentication to work with webdav in docker compose?
I want to build a private webdav server behind traefik with authentication.我想在 traefik 后面构建一个带有身份验证的私有 webdav 服务器。
Here is the docker-compose.yml file:这是 docker-compose.yml 文件:
version: '3.7'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
labels:
- "traefik.http.middlewares.test-auth.digestauth.users=${AUTHUSER}"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
webdav:
image: mwader/webdav
labels:
- "traefik.http.routers.webdav.rule=Host(`localhost`)||Host(`mydomain`)"
volumes:
- /data:/webdav
After "# docker-compose up -d", webdav is working, but without any authentication, which should be digest auth.在“#docker-compose up -d”之后,webdav 工作正常,但没有任何身份验证,应该是摘要身份验证。 Now anyone knows the domain can access my files.现在任何人都知道该域可以访问我的文件。 That's not acceptable.这是不可接受的。 So is there any where I did wrong?那么有什么地方我做错了吗? How can I get it right?我怎样才能正确? Thanks!谢谢!
It is not enough to define the middleware, you must use it with routers.仅定义中间件是不够的,您必须将其与路由器一起使用。 Try to use this stack尝试使用此堆栈
version: '3.7'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
labels:
- "traefik.http.middlewares.test-auth.digestauth.users=${AUTHUSER}"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
webdav:
image: mwader/webdav
labels:
- "traefik.http.routers.webdav.rule=Host(`localhost`)||Host(`mydomain`)"
- "traefik.http.routers.webdav.middlewares=test-auth"
volumes:
- /data:/webdav
More information, details, and examples can be found in this article可以在本文中找到更多信息、详细信息和示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.