Portainer docker behind Traefik / URL not working Gateway timeout error 504

No, when using Traefik, you don’t want portainer to listen on the node, as that would enable to circumvent any Traefik security middlewares.

Traefik and portainer should both be connected to a Docker network, within all ports are reachable. Only Traefik should listen on external ports.

Check simple Traefik example and other post about portainer.