问题描述
我使用以下标签在 Docker 暖模式下运行服务:
I run the service in Docker Warm Mode with these labels:
- "traefik.docker.network=proxy"
- "traefik.backend=kibana"
- "traefik.frontend.entryPoints=https,http"
- "traefik.frontend.rule=Host:mydomain"
- "traefik.port=5601"
- "traefik.frontend.auth.basic=test:098f6bcd4621d373cade4e832627b4f6"
使用 HTTPS 时遇到此问题
And have this problem using HTTPS
curl -u test:test https://my-domain.com
401 Unauthorized
使用 HTTP 一切正常
With HTTP all is ok
curl -u test:test http://my-domain.com
Found
推荐答案
我找到了问题的原因,我使用 traefik 变量将服务部署为堆栈 "traefik.frontend.auth.basic=test:$$apr1$$EaOXV0L6$DQbzuXBeb6Y8jjI2ZbGsg/"
.但是这个变量的部署值看起来像 test:/
.
I found cause of problem, I deploy service as a stack with traefik variable "traefik.frontend.auth.basic=test:$$apr1$$EaOXV0L6$DQbzuXBeb6Y8jjI2ZbGsg/"
. But after deploy value of this variable looks like test:/
.
手动设置正确的值后 - auth 工作正常.
After manually setting correct value - auth work fine.
我也尝试使用命令 docker service create 部署服务并且变量具有正确的值.
Also I have tried deploy service with command docker service create and variable have correct value.
这篇关于Traefik 基本身份验证不适用于 HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!