[SOLVED] Strange 504 Gateway Timeout behaviour

Hi! I am trying out Traefik v2 with docker-compose on Windows. I have a working version with this docker-compose.yml:

version: '3.3'

services:
    reverse-proxy:
        image: traefik:v2.4
        command:
            - --api=true
            - --api.insecure=true
            - --ping=true
            - --accesslog=true
            - --api.debug=true
            - --api.dashboard=true
            - --providers.docker=true
            - --providers.docker.exposedbydefault=false
            - --entrypoints.web.address=:80
        ports:
            - "80:80"
            - "8080:8080"
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
        networks:
            - web
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.api.service=api@internal" 
    webserver:
        build:
            context: ./nginx
        volumes:
            - ./application:/var/www/html
        networks:
            - web 
            - internal
        depends_on:
            fpmserver:
                condition: service_started
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.nginx-web.entrypoints=web" 
            - "traefik.http.routers.nginx-web.rule=Host(`melissa.gr`)" 
    fpmserver:
        build:
            context: ./fpm
        scale: 2
        volumes:
            - ./application:/var/www/html
        networks:
            - internal
networks:
    web:
        external: true
    internal:
        external: false

Then, I go and change something to PHP-FPM configuration. I rebuild, start containers and I am getting 504 Gateway Timeout, even for those requests that are not served by FPM. Traefik API and dashboard work fine. I go back and undo the change and try again. Nothing! Still getting "Gateway Timeout", though it is the same working configuration I initially had. This strange situation have happened several times till now when I was changing things at any place (docker-compose.yml, nginx configuration, fpm configuration,...).

It's getting really frustrating. Any ideas about the reason of this unstable behavior ? :anguished:

1 Like

Your webserver service is on two networks. You need to direct docker to the correct network.

On the service you can use the label traefik.docker.network or you can use the provider version on traefik. Docker - Traefik The value is the network name you would see with docker network ls

6 Likes

Daammmnnn me! :grimacing:
It was that!

Thanks a lot!!! :bowing_man:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.