traefik: Traefik stops working when Nextcloud iOS app connects (setsockopt: operation not supported)

Welcome!

  • Yes, I’ve searched similar issues on GitHub and didn’t find any.
  • Yes, I’ve searched similar issues on the Traefik community forum and didn’t find any.

What did you do?

Since the last update to 3.4.3, traefik crashes multiple times a day. I can’t say if there were some other updates involved, too.

Having a look at the logs, this is what I see:

2025-06-29T16:38:07+02:00 ERR error="set tcp 172.18.0.16:443->80.187.71.29:31600: setsockopt: operation not supported" entryPointName=websecure

2025-06-29T16:38:07+02:00 ERR Error while starting server error="set tcp 172.18.0.16:443->80.187.71.29:31600: setsockopt: operation not supported" entryPointName=websecure

2025-06-29T16:38:07+02:00 ERR Error while starting server error="set tcp 172.18.0.16:443->80.187.71.29:31600: setsockopt: operation not supported" entryPointName=websecure

There’s nothing more in the logs.

What did you see instead?

Opening any URL that is served through traefik can’t be reached anymore.

What version of Traefik are you using?

v3.4.3

What is your environment & configuration?

traefik.yml

api:
  dashboard: true

entryPoints:
  web:
    address: ":80"
    forwardedHeaders:
      trustedIPs: 
        - "10.0.0.0/8"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: ":443"

providers:
  swarm:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
    network: "traefik_default"
  file:
    filename: "./dynamic_conf.yml"

certificatesResolvers:
  le:
    acme:
      email: info@tsmd.de
      storage: acme.json
      httpChallenge:
        # used during the challenge
        entryPoint: web

dynamic_conf.yml

tls:
  options:
    default:
      minVersion: VersionTLS12

      cipherSuites:
        - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
        - TLS_AES_128_GCM_SHA256
        - TLS_AES_256_GCM_SHA384
        - TLS_CHACHA20_POLY1305_SHA256

      curvePreferences:
        - CurveP521
        - CurveP384

      sniStrict: true


http:
  middlewares:
    secHeaders:
      headers:
        browserXssFilter: true
        contentTypeNosniff: true
        frameDeny: true
        sslRedirect: true
        #HSTS Configuration
        stsIncludeSubdomains: true
        stsPreload: true
        stsSeconds: 31536000
        customFrameOptionsValue: "SAMEORIGIN"

Traefik is running in a docker swarm environment

If applicable, please paste the log output in DEBUG level

Nothing relevant/related in the debug logs.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 19 (2 by maintainers)

Most upvoted comments

This is not just related to Nextcloud or iOS — it’s a more general issue.

At work, I manage four servers running Traefik. Only two of them are affected: every 5 minutes or so, both HTTP and HTTPS connections are closed.

The first affected server has around 120 domains. The issues started as soon as version 3.4.3 was rolled out. The second affected server was fine with only 1–2 domains, but once I added 5 domains, the problems began there too.

The third and fourth servers, with around 175 and 10 domains respectively, are running the same version (3.4.3) without any problems. They have more or less the same containers and configuration.

The only notable similarity between the two problematic servers is that their Docker engine has been updated. The other two are still running an older version of Docker. In the moment i put 3.4.2 and 3.4.1, the problem disappear

@dtscd As I said, in my case, as in some others, http3 is enabled, but there are already some comments from people who have http3 disabled.

Same problem here. v3.4.3 and v3.5.0rc1 let Traefik crash. It crashes, when my nextcloud client tries to upload data. Traefik v3.4.1 runs without problems.

Problem

amd64, Linux

I don’t believe this has anything to do with nextcloud, but we do have ios clients for an API endpoint we serve behind traefik. We were running v3.4.3. It took me a few minutes to realize what was going on, because traefik was still running but the https “websecure” endpoint had stopped. restarting the daemon set fixed the issue and I reverted to 3.4.1 and added a liveliness probe on tcp 443.

I did have http3 enabled as well.

Logs:

2025-07-02T23:34:34Z ERR error="set tcp 10.50.45.5:443->135.180.27.111:53883: setsockopt: operation not supported" entryPointName=websecure
2025-07-02T23:34:34Z ERR Error while starting server error="set tcp 10.50.45.5:443->135.180.27.111:53883: setsockopt: operation not supported" entryPointName=websecure
2025-07-02T23:34:34Z ERR Error while starting server error="set tcp 10.50.45.5:443->135.180.27.111:53883: setsockopt: operation not supported" entryPointName=websecure

Diagnosis

My first guess, this error is originating on pkg/server/server_entrypoint_listenconfig_unix.go in func controlReusePort however I am NOT enabling port reuse, and there is zero way to get to that code without setting the resuse config setting directly. As such it has nothing to do with port reuse.

As such, this error must be returning in the go std lib in either src/net/sockopt_posix.go or src/net/tcpsocketopt_unix.go, in one of:

  • setKeepAliveIdle
  • setKeepAliveInterval
  • setKeepAliveCount
  • setReadBuffer
  • setWriteBuffer
  • setKeepAlive
  • setLinger

This brings back to the traefik repo at pkg/server/server_entrypoint_tcp.go:689 (v3.4.3).

Now this wasn’t in the startup of the TCP server, but while it was running for a few days. Though this is running with a dynamic kubernetes provider.

I think it is likely that in func (ln tcpKeepAliveListener) Accept(), the tc.SetKeepAlive returned an error here for some reason. As a “set” keepalive error is not considered “Temporary” (net.OpError) and thus will break out of the http.Serve for loop.

Suggested changes

  • It would be ideal if the goroutine on like 686 (v3.4.3) errors, that it informs the API that the endpoint has failed so the dashboard shows that the endpoint has stopped working.
  • It would be ideal that a TCP KeepAlive syscall error doesn’t bring down the entire http server.

Reflection

I’m honestly not sure why I’m getting an setsockopt error. I normally run traefik and don’t get this error. Restarting the daemon set solved this as well.

This certainly spooked me when I read the code that can take down an http handler without notifying any status or the entire process, so none of my normal failsafes or restarts can kick in. I’ve added the tcp probe on 443 for now, but it would be great to remove the vector all together.