Home > Software design >  Traefik returns error 404 on http requests
Traefik returns error 404 on http requests

Time:08-21

I have a traefik reverse proxy instance running inside docker on linux. I have the issue that traefik always returns 404 on http requests but not on https requests. Https requests are working without any issue.

This is my 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:

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

CodePudding user response:

I solved this issue by creating two seperate routers for http and https.

  • Related