简体   繁体   English

Traefik 在 http 请求上返回错误 404

[英]Traefik returns error 404 on http requests

I have a traefik reverse proxy instance running inside docker on linux.我有一个 traefik 反向代理实例在 linux 上的 docker 内运行。 I have the issue that traefik always returns 404 on http requests but not on https requests.我的问题是 traefik 总是在 http 请求上返回 404,但在 https 请求上却没有。 Https requests are working without any issue. Https 请求工作正常,没有任何问题。

This is my docker-compose.yml:这是我的 docker-compose.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

My traefik config:我的 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

I solved this issue by creating two seperate routers for http and https.我通过为 http 和 https 创建两个单独的路由器解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM