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

**URL:** <https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684>\
**Category:** Traefik v2\
**Tags:** docker-swarm, middleware\
**Created:** [August 31, 2023, 9:31am UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684 "2023-08-31T09:31:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![seeteshhindlekar](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@seeteshhindlekar](https://community.traefik.io/u/seeteshhindlekar)\
**Post date:** [August 31, 2023, 9:31am UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/1 "2023-08-31T09:31:52Z")

</div>

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 manage.py runserver 0.0.0.0:8000". and for labels: traefik.http.routers.web.rule=Host(`web.sampledataflow.com`)

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [August 31, 2023, 9:47am UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/2 "2023-08-31T09:47:15Z")

</div>

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](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt) and [simple Swarm Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-swarm-traefik).

---

<div class="post-metadata">

**Author:** ![seeteshhindlekar](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@seeteshhindlekar](https://community.traefik.io/u/seeteshhindlekar)\
**Post date:** [August 31, 2023, 5:32pm UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/3 "2023-08-31T17:32:04Z")

</div>

[GitHub - seeteshhindlekar/Traefik](https://github.com/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

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [August 31, 2023, 6:27pm UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/4 "2023-08-31T18:27:23Z")

</div>

Not sure why you use a year old version:

```auto
  image: traefik:v2.2

```

I recommend to add `=true` to

```auto
--providers.docker.swarmmode

```

Not sure if those lines make sense:

```auto
- traefik.constraint-label=traefik-public

```

```auto
traefik.constraint-label-stack: results.seetesh.com

```

AFAIK you can’t have a space in a router name:

```auto
traefik.http.routers.dev-seetesh -com-backend-http.rule: PathPrefix(`/api`)
          || PathPrefix(`/docs`) || PathPrefix(`/redoc`)

```

Check Traefik dashboard, Traefik debug ([doc](https://doc.traefik.io/traefik/observability/logs/#level)) and access log ([doc](https://doc.traefik.io/traefik/observability/access-logs/#format)) for what is happening.

You could try just to run the simple Swarm Traefik example from [above](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/2) to test if it works with AWS, then plug in your services bit by bit.

---

<div class="post-metadata">

**Author:** ![seeteshhindlekar](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@seeteshhindlekar](https://community.traefik.io/u/seeteshhindlekar)\
**Post date:** [August 31, 2023, 6:43pm UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/5 "2023-08-31T18:43:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![seeteshhindlekar](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@seeteshhindlekar](https://community.traefik.io/u/seeteshhindlekar)\
**Post date:** [September 6, 2023, 11:08am UTC](https://community.traefik.io/t/traefik-not-connecting-to-python-apps-on-aws-production-using-docker-swarm/19684/6 "2023-09-06T11:08:03Z")

</div>

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
