Unable to setup Mercure with docker and Nginx (502 Bad Gateway)

See, now I know both services are in the same compose file and can access each other by service name.
It would have been better to aonymize credentials and tokens…

You have two possibilites:

  1. use path based rules in traefik and bypass the nginx container for the dj_mercure traffic
  2. keep nginx and use proxy_pass http://dj_mercure:3000; in your nginx.conf instead of proxy_pass http://127.0.0.1:3000;. Since both container share the same network,nginx can access the dj_mercure`service by its service name. )See NGINX swarm redeploy timeouts - #5 by meyay for further optimizations)

Solution 1 is the better solution, as traefik adds/removes reverse proxy rules then a container start or stop event is published.

`

2 Likes