gpt4 book ai didi

basic-authentication - 基本身份验证不适用于 Traefik v2.1

转载 作者:行者123 更新时间:2023-12-04 00:52:32 25 4
gpt4 key购买 nike

我的问题是我无法设置 basic authentication通过 traefik 为我的前端应用程序
这就是我如何配置我的 traefik
traefik.yml

global:
checkNewVersion: true
sendAnonymousUsage: false

entryPoints:
https:
address: :443
http:
address: :80
traefik:
address: :8080

tls:
options:
foo:
minVersion: VersionTLS12
cipherSuites:
- "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
- "TLS_RSA_WITH_AES_256_GCM_SHA384"

providers:
providersThrottleDuration: 2s
docker:
watch: true
endpoint: unix:///var/run/docker.sock
exposedByDefault: false
network: web

api:
insecure: true
dashboard: true

log:
level: INFO

certificatesResolvers:
default:
acme:
storage: /acme.json
httpChallenge:
entryPoint: http
docker-compose.yml
version: '3'
services:
traefik:
image: traefik:v2.0
restart: always
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/srv/traefik/traefik.yml:/etc/traefik/traefik.yml"
- "/srv/traefik/acme.json:/acme.json"
networks:
- web

networks:
web:
external: true
这是我的前端应用程序作为 traefik 提供程序运行的地方,以及我的基本身份验证标签的地方
version: '3.7'
services:
frontend:
image: git.xxxx.com:7000/dockerregistry/registry/xxxx
restart: "always"
networks:
- web
volumes:
- "/srv/config/api.js:/var/www/htdocs/api.js"
- "/srv/efs/workspace:/var/www/htdocs/stock"
labels:
- traefik.enable=true
- traefik.http.routers.frontend-http.rule=Host(`test.xxxx.com`)
- traefik.http.routers.frontend-http.service=frontend
- traefik.http.routers.frontend-http.entrypoints=http
- traefik.http.routers.frontend.tls=true
- traefik.http.routers.frontend.tls.certresolver=default
- traefik.http.routers.frontend.entrypoints=http
- traefik.http.routers.frontend.rule=Host(`test.xxxx.com`)
- traefik.http.routers.frontend.service=frontend
- traefik.http.middlewares.frontend.basicAuth.users=test:$$2y$$05$$c45HvbP0Sq9EzcfaXiGNsuuWMfPhyoFZVYgiTylpMMLtJY2nP1P6m
- traefik.http.services.frontend.loadbalancer.server.port=8080

networks:
web:
external: true
我无法获得登录提示,所以我想知道我是否为此缺少一些容器标签。
提前致谢!华金

最佳答案

首先,标签应该像这样的引号“”
其次,我认为您在前端应用程序中缺少标签。
使用基本身份验证时需要两个步骤,应该如下所示:

  - "traefik.http.routers.frontend.middlewares=frontend-auth"
- "traefik.http.middlewares.frontend-auth.basicauth.users=test:$$2y$$05$$c45HvbP0Sq9EzcfaXiGNsuuWMfPhyoFZVYgiTylpMMLtJY2nP1P6m"

关于basic-authentication - 基本身份验证不适用于 Traefik v2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65404777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com