traefikmautic

Getting "Gateway Timeout" for Mautic behind Traefik proxy


I deployed an multicontainer application with Mautic behind a Traefik reverse proxy. However, I am getting a "Gateway timeout".

The reverse proxy's configuration seems OK as other containers within the application work fine.

I also changed the mautic settings to the mautics domain name.

Any idea?

docker-compose.yml

version: '3.3'

services:
  reverse-proxy:
    image: traefik:v2.4
    restart: always
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - ./traefik:/etc/traefik
      - /var/run/docker.sock:/var/run/docker.sock

  mautic-app:
    restart: always
    image: mautic/mautic:v3
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=mautic-database
      - MAUTIC_DB_USER=${MAUTIC_DB_USER}
      - MAUTIC_DB_PASSWORD=${MAUTIC_DB_PASSWORD}
      - MAUTIC_DB_NAME=mautic3
    ports:
      - 80
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.mautic.tls=true'
      - 'traefik.http.routers.mautic.tls.domains[0].main=optin.${SITE}'
      - 'traefik.http.routers.mautic.tls.certresolver=lets-encrypt'
      - 'traefik.http.routers.mautic.rule=Host(`optin.${SITE}`)'
    depends_on:
      - mautic-database
    networks:
      - mautic-net

  mautic-database:
    image: powertic/percona-docker
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MAUTIC_DB_PASSWORD}
    ports:
      - 3306
    volumes:
      - database:/var/lib/mysql
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --sql-mode=""
    networks:
      - mautic-net

volumes:
  database:
    driver: local
  mautic_data:
    driver: local

networks:
  mautic-net:
    driver: bridge

traefik.toml

[log]
  level = "DEBUG"

[providers]
  [providers.docker]
    exposedByDefault = false
  [providers.file]
    directory = "/etc/traefik/dynamic"

[entryPoints]
  [entryPoints.http]
    address = ":80"
  [entryPoints.https]
    address = ":443"

[certificatesResolvers.lets-encrypt.acme]
  storage = "/etc/traefik/acme.json"
  email = "jenslaufer@jenslaufer.com"
  [certificatesResolvers.lets-encrypt.acme.tlsChallenge]

force-https.toml

[http.routers]
  [http.routers.force-https]
    entryPoints = ["http"]
    middlewares = ["force-https"]
    rule = "HostRegexp(`{any:.+}`)"
    service = "noop"

[http.middlewares]
  [http.middlewares.force-https.redirectScheme]
    scheme = "https"

[http.services]
  [http.services.noop.loadBalancer]

Solution

  • It's a "misconfiguration" in docker-compose: Traefik and Maurice are in different networks.

    Moving Traefik to the mautic-net network fixed the problem.