Gateway timeout with APM Server

Hi,
I'm getting a gateway timeout when running Traefik in front of APM Server

Traefik config

reverse-proxy:
    image: traefik:v2.6
    command:
      - "--accesslog=true"
      - "--accesslog.filepath=/var/log/traefik/access.log.json"
      - "--accesslog.fields.headers.defaultmode=keep"
      - "--accesslog.format=json"
      - "--api.insecure=true"
      - "--log.level=DEBUG"
      - "--providers.docker"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.cert.acme.httpchallenge=true"
      - "--certificatesresolvers.cert.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.cert.acme.email=cgrocock@**********.co.uk"
      - "--certificatesresolvers.cert.acme.storage=/letsencrypt/acme.json"
      - "--tracing.elastic.serverurl='http://apm:8200'"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - ./letsencrypt:/letsencrypt
      - /var/log/traefik:/var/log/traefik
      - /var/run/docker.sock:/var/run/docker.sock

APM

apm:
    image: docker.elastic.co/apm/apm-server:${ELASTIC_VERSION}
    user: root
    ports:
      - 8200:8200
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.apm.rule=PathPrefix(`/apm`)"
      - "traefik.http.routers.apm.tls.certresolver=cert"
      - "traefik.http.routers.apm.entrypoints=websecure"
      - "traefik.http.routers.apm.priority=60"
      - "traefik.http.services.apm.loadbalancer.server.port=8200"
      - "traefik.http.middlewares.strip-path.stripprefix.prefixes=/apm"
      - "traefik.http.routers.apm.middlewares=strip-path"
    volumes:
      - ./apm/apm.yml:/usr/share/apm-server/apm-server.yml
    networks:
      - elk
      - application
    depends_on:
      - elasticsearch

Hi @ConorGrocock,
Thanks for your interest in Traefik.

Gateway timeout happens when Traefik is not able to communicate with your service.
Looking at your configuration, it seems you are using several networks on APM. When using 2 or more networks on a container, Traefik doesn't know which network to use. You have to help by providing him a network to work on.

Try to add this label to your traefik container:

- --providers.docker.network=elk
// or
- --providers.docker.network=application

EDIT: This is a link to the documentation Traefik Docker Documentation - Traefik