Search code examples
angularcorsnestjstraefik

Traefik creates randomly 504 and CORS errors in interval call by angular


I replaced my nginx based proxy with traefik for my angular frontend and nestjs backend. In an interval I am requesting the latest updates for my dashboard and my events. The response is returned in about 20ms with 50B.

But for some reasons some calls get stuck in pending after one minute (there are no updates for the backend, no big database and there are 8 dedicated CPUs) and result in a 504 and a CORS error:

enter image description here

enter image description here

Some calls then work again and then I get errors again... I can't remember having anything like this with nginx, there is nothing specific configured for my traefik instance.


Solution

  • In my scenario I had two different networks:

    • all my containers are in the network called proxy (traefik, frontend, backend)
    • in the static file of traefik under providers.docker.network I had traefik_web set, a network where the three containers are not part of

    I don't have the full explanation but I think docker is updating internal routings and because the value traefik need is not equal it can get to some troubles sometime.

    After setting the value correclty, it seems to run smoothly again