Traefik in swarm mode - how to pass traffic to ip outside of swarm?


standard traefik container verison v2.1.4
I have working traefik service in my swarm, all is working perfectly for services inside the swarm.
But I cannot figure out how to pass the traffic to the service outside of swarm

I tried to add those labels to the traefik service
- traefik.http.routers.service.rule=Host(
- traefik.http.routers.service.entrypoints=websecure
- traefik.http.routers.service.tls=true
- traefik.http.routers.service.tls.certresolver=leresolver

192.168.1.xx points to the machine in the internal network serving http on port 8080

obviously as part of the command
- "--entrypoints.websecure.address=:443"
- ""
- ""
- "--certificatesresolvers.leresolver.acme.tlschallenge=true"

any help?


To define routing outside of your cluster, you have to use the file provider.
The labels are only to create routing based on container.

thank you
it sort of works
except the router does not seem to pick up my certificate resolver.
Do I need to define another one for use with file?

my router config in file looks like this

      - websecure
      service: service
      rule: Host(``)
        certresolver: leresolver

the traefik ui says that TLS is set to true but does not list any resolver

got it

surprisingly there is a requirement to spell it

thank you gain!

Hi There!

I’m also seeing a similar issue where Traefik v2 on swarm seems work great for Docker services but I keep getting 502 Bad Gateway Errors when I try to create a local (non Docker) proxy to an internal IP using the File Provider below? If you got this working with both Docker Providers and File Providers,
Could you please post your setup for the Traefik Stack and your dynamic file provider?

     entryPoints = [ "https" ]
     rule = "Host(``)"
     service = "testhttp-svc"
       certResolver = "letsencryptresolver"

      passHostHeader = true
        url = ""