Search code examples
traefiktraefik-routers

Traefik v2: 404 Page not found


I am having issues routing my traffic through traefik v2 and getting a 404.

I have an application which runs under Server A) and Traefik which runs under Server B). Both Server can communicate to each other. On Server A) also runs a Apache Tomecat with default configuration and the Application is accessable through:

http://10.15.3.2:8301/myphpapp/login.html

On Server B) runs my Traefik as Docker container.

docker-compose.yml:

version: '3.8'
networks:
  traefik:
    name: traefik
services:
  traefik:
    command:
      - --api.insecure=true
      - --certificatesresolvers.letsencrypt.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
      - --certificatesresolvers.letsencrypt.acme.dnschallenge=true
      - --certificatesresolvers.letsencrypt.acme.dnschallenge.disablepropagationcheck=true
      - --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=xxxx
      - --certificatesresolvers.letsencrypt.acme.dnschallenge.delaybeforecheck=0
      - [email protected]
      # acme.json is the file which stores the SSL certificate
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.file.directory=/etc/traefik/dynamic
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
    container_name: traefik
    environment:
      - https_proxy=http://x.x.x.x:80
      - http_proxy=http://x.x.x.x:80
    image: traefik:2.10.4
    networks:
      - traefik
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    restart: always
    volumes:
      - /data/traefik/letsencrypt:/letsencrypt
      - /data/traefik/dynamic_configuration:/etc/traefik/dynamic
      - /var/run/docker.sock:/var/run/docker.sock:ro

I am using a dynamic config according to https://doc.traefik.io/traefik/getting-started/configuration-overview/#the-dynamic-configuration and https://doc.traefik.io/traefik/getting-started/configuration-overview/#the-dynamic-configuration to route traffic to this service without modifying the static configuration or restarting Traefik.

Dynamic config traefik.yml:

http:
  routers:
    inventoryapp-router:
      rule: "Host(`myawesomeapp.de`) && PathPrefix(`/myphpapp`)"
      service: inventoryapp-service

  services:
    inventoryapp-service:
      loadBalancer:
        servers:
          - url: "http://10.15.3.2:8301"

After calling myawesomeapp.de/myphpapp/login.html through http or through https I am getting a 404 Page not found.


Solution

  • Issue is resolved.

    The issue was a Proxy. My Traefik docker compose had a proxy configuration for http and https.

        environment:
          - https_proxy=http://x.x.x.x:80
          - http_proxy=http://x.x.x.x:80
    

    solution was to add a:

          - no_proxy=IP_of_my_backend_service