Traefik not connecting to Python apps on AWS Production using Docker Swarm

Somehow Traefik is not able to connect ie reroute traffic to the Python apps deployed on the AWS Ubuntu servers created using Docker Swarm. Same is observed on local Windows desktops where docker file has the Python app listening on port 8000 but proxy set does not connect to the 8000 port as per command syntax for eg. docker-compose has the following entry for the python app === command: sh -c "python3.11 runserver". and for labels: traefik.http.routers.web.rule=Host(

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

Format your code with 3 backticks in front and after, or select the code and press </> . In yaml every space matters. And it makes it so much more readable for people trying to help you.

In the meantime, check this simple Traefik example and simple Swarm Traefik example.

GitHub - seeteshhindlekar/Traefik is the link where I have uploaded few files. Docker compose file was used as a sample locally using portainer and not for development. We use docker stack deploy to run the file

Not sure why you use a year old version:

  image: traefik:v2.2

I recommend to add =true to


Not sure if those lines make sense:

- traefik.constraint-label=traefik-public

AFAIK you can’t have a space in a router name: -com-backend-http.rule: PathPrefix(`/api`)
          || PathPrefix(`/docs`) || PathPrefix(`/redoc`)

Check Traefik dashboard, Traefik debug (doc) and access log (doc) for what is happening.

You could try just to run the simple Swarm Traefik example from above to test if it works with AWS, then plug in your services bit by bit.

I guess while editing the spaces must have been added. The setup was done by another team member 1.5 years ago so the old version of 2.x

port 8080 is not set for the Dashboard since this is the prod server file extracted and trimmed for sensitive information.

Added the docker-compose.yml on the Github branch for your reference.

Which city/country are you from?

even upgrading to new version it did not help. Are you able to find the routing issue? I tried the same on my local windows docker pointing to apps developed using React, Python and Java - Spring Boot. Traefik does not route the requests to the url provided for these apps. Tried the Portainer way too looking at youtube videos but doesnt work for me