Traefik在http请求中返回错误404



我有一个traefik反向代理实例在linux的docker中运行。我有一个问题,traefik总是在http请求上返回404,但在https请求上不返回。Https请求正在正常工作,没有任何问题。

这是我的码头组合。yml:

version: '3'

services:
ucp:
image: ghcr.io/rp-projekt/rp-server/ucp:main
volumes:
- /home/docker/ucp/.env:/usr/src/app/.env
networks:
- rp
restart: unless-stopped
extra_hosts:
- "docker.host.internal:host-gateway"
- "host.docker.internal:host-gateway"
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.redir-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.redir-https.redirectscheme.permanent=true"
- "traefik.http.routers.ucp.middlewares=redir-https@docker"
- "traefik.http.routers.ucp.tls.certresolver=le"
- "traefik.http.routers.ucp.rule=Host(`ucp.roestipommes.de`)"
- "traefik.http.routers.ucp.entrypoints=web,websecure"
- "traefik.http.services.ucp.loadbalancer.server.port=80"
- "traefik.http.routers.ucp.service=ucp"
networks:
rp:
external: true

我的traefik配置:

entryPoints:
web:
address: ":80"
forwardedHeaders:
trustedIPs:
- "127.0.0.1/32"
- "172.16.0.0/12"
- "10.0.0.0/8"
- "192.168.0.0/16"
websecure:
address: ":443"
forwardedHeaders:
trustedIPs:
- "127.0.0.1/32"
- "172.16.0.0/12"
- "10.0.0.0/8"
- "192.168.0.0/16"
providers:
file:
filename: /dynamic_config.yaml
docker:
exposedbydefault: False
certificatesResolvers:
le:
acme:
email: hidden
httpChallenge:
entryPoint: web

我通过为http和https创建两个独立的路由器来解决这个问题。

我不是这方面的专家,但据我所知,我是通过入口点上的配置实现的

# Entry Points configuration
# ---
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https

也许这有帮助。

问候

Tore

最新更新