Properly Specifying a Static Service using File Provider

I have a swarm with Traefik and other services. I have a docker-compose container in the same network, but not in the swarm (as it requires privileged access). Nevertheless, I can ping that container from Traefik. As the service it outside the swarm, I am trying to configure it as a static service, using the file provider. As far as I can understand, I should be quite near the proper solution. But I am getting a "Service Unavailable". Some insights are welcome.

Follows my toml configuration.

      rule = "Host(``)"
      service = "foo"
      middlewares = ["https-redirect"]
      entryPoints = ["http"]

      rule = "Host(``)"
      entryPoints = ["https"]
      service = "foo"
        certResolver = "le"

        passHostHeader = true
          #port = 443
          #scheme = "https"
          url = "https://foo_container:443"

      scheme = "https"
      permanent = true

Hi @ambs

You have the overlay network created as attachable and the singleton container attached to that network?

Hi, @cakiwi .
Yes, I have. As I said, I am able to ping the container from inside the bash of Traefik container.
Also, just for testing, I tried to use the IP directly on the URL, and it still didn't work.
To be sure the request wasn't being rejected by the service, I tried to wget it from a temporary container, and it is answering and logging. When I try to access the domain through Traefik, the service doesn't log any request.
Thanks for any help,

This is fishy. Http on port 443?

Yeah, you are correct. Unfortunately that is not the problem. I did test a lot of combinations, and I didn't notice that I was posting a stupid approach. As you can see, I even have two lines commented for port and scheme.
My current attempt is with https and port specified, as updated in the original message.
Thank you

Is the cert presented by foo_container signed by a public CA?

No, it is not.
In any case, I have this in the static config:


Not sure if I need something more.

No I think that should cover it.

Anything in the trafik logs? Turned it up to debug?

Sorry for the delay. Just wanted to be sure before answering, as I've tested that before, but did not take note of the exact message.

I am getting only the access log:

traefik_traefik.1.t6oixgxfcmfr@xxx    | - - [17/Mar/2021:15:10:50 +0000] "GET / HTTP/2.0" 503 19 "-" "-" 3 "foo-https@file" "-" 0ms

I have only this:


Not sure there is anything more I can turn on to keep debugging.
Thank you

Yes, that is it. I would recommend json format for the accesslogs, as there is more information in it, such as Origin Response. You can add it to the CLF format logs too if you wish.

You could try insecureSkipVerify option at the service level too.

I think this is not helping much...


Setting insecureSkipVerify at the service level did not help, too.
Is there any other trick I can use debug this properly?

Well that certainly looks to me like the 503 is coming from the origin. Its not liking something that is coming from traefik. Is the service expecting a certain SNI ?

Sorry for my ignorance, what is a SNI? I tried googling, but I didn't understand it properly.

Just for reference, I was using traefik without swarm mode, and this service was working. As now I am putting traefik in swarm, and the service from a compose, I can't use the same configuration (labels in the service).

These were my labels when the system was running without swarm mode (and it worked):

        traefik.enable: true traefik-public
        traefik.constraint-label: traefik-public Host(``) http https-redirect Host(``) https true le 443 https

From inside traefik docker container:

/ # wget -S https://foo:443/
Connecting to foo:443 (
ssl_client: foo: certificate verification failed: self signed certificate
wget: error getting response: Connection reset by peer

And I get this logged into foo log.
Thus, I still suspect something is wrong on Traefik side...

1 Like

I find curl better for this.

curl -k -i https://foo

It is strange that changing it to swarm would result in this difference.

Taefik busybox doesn't include curl, as far as I could go.

FYI apk -u add curl

If I get a moment I'll try a similar setup this weekend. What kind of container is the standalone serving https?

1 Like

Ooops, I could have shared that before. With the masking of the URLs forgot to specify that.
It is Pritunl VPN server (that requires privileged access, and thus, can't be run under swarm).

Sharing here the static config too, in case I am doing some mistake there:

 #format = "json"

 #format = "json"


   swarmMode = true
   watch = true
   exposedByDefault = false
   constraints = "Label(`traefik.constraint-label`, `traefik-public`)"
    filename = "/etc/traefik/dynamic.toml"

dashboard = true

   address = ":80"

   address = ":443"

    email = ""
    storage = "/certificates/acme.json"