skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

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


  2. I am not a specialist in this, but as far as I can see, I got this working via a config on the entrypoint

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

    Maybe it helps.

    Kind regards

    Tore

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search