# Route TCP to an SFTP server

**URL:** <https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098>\
**Category:** Traefik v2\
**Tags:** tcp\
**Created:** [July 1, 2023, 4:57pm UTC](https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098 "2023-07-01T16:57:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArthurMitchell42](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/arthurmitchell42/32/7287_2.png) [@ArthurMitchell42](https://community.traefik.io/u/ArthurMitchell42)\
**Post date:** [July 1, 2023, 4:57pm UTC](https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098/1 "2023-07-01T16:57:58Z")

</div>

I'm extending my Traefik setup to have a new entry point and route SFTP traffic to a server inside the network. At the moment I can't get any connection at all and the logs, even set to debug haven't given me any data to work on.  
My static setup is now as follows:

```auto
entryPoints:
  #--------------------------
  http:
    address: :6080
    forwardedHeaders:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
    proxyProtocol:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
    http:
      redirections:
        entrypoint:
          to: https
          scheme: https
  #--------------------------
  https:
    address: :6443
    forwardedHeaders:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
    proxyProtocol:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
    http:
      tls:
        certResolver: letsencrypt
  #--------------------------
  traefik:
    address: :6081
    forwardedHeaders:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
    proxyProtocol:
      trustedIPs: 10.0.10.0/24,172.16.0.0/16,192.168.0.0/16,fc00::/7
      insecure: false
  #--------------------------
  sftp:
    address: :2223/tcp

```

and in the dynamic file I've added a tcp: section as follows:

```auto
tcp:
  routers:
    sftp-router:
      entryPoints:
        - "sftp"
      rule: "HostSNI(`*`)"
      service: "sftp-service"
      tls:
        passthrough: true

  services:
    sftp-service:
      loadBalancer:
        servers:
          - address: "10.0.10.10:2222"

```

in the Traefik log all I see is:

```auto
time="2023-07-01T16:57:44+01:00" level=debug msg="Starting TCP Server" entryPointName=sftp
time="2023-07-01T16:57:44+01:00" level=debug msg="Creating middleware" entryPointName=sftp middlewareName=metrics-entrypoint middlewareType=Metrics
time="2023-07-01T16:57:44+01:00" level=debug msg="Creating TCP server 0 at 10.0.10.10:2222" serverName=0 entryPointName=sftp routerName=sftp-router@file serviceName=sftp-service
time="2023-07-01T16:57:44+01:00" level=debug msg="Adding Passthrough route for \"HostSNI(`*`)\"" entryPointName=sftp routerName=sftp-router@file

```

My first question is, have I got this setup completely wrong please? The HTTP(S) routing is fine and has been for the last 2 years, I just can't get any TCP path to the SFTP server.  
Thanks, Arthur

---

<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:** [July 1, 2023, 6:34pm UTC](https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098/2 "2023-07-01T18:34:01Z")

</div>

I think when using

```auto
    tls:
        passthrough: true

```

you enable TLS in Traefik on that route, but you want it to pass as plain TCP, so try removing it.

See [simple Traefik TCP example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-tcp).

---

<div class="post-metadata">

**Author:** ![ArthurMitchell42](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/arthurmitchell42/32/7287_2.png) [@ArthurMitchell42](https://community.traefik.io/u/ArthurMitchell42)\
**Post date:** [July 1, 2023, 8:09pm UTC](https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098/3 "2023-07-01T20:09:02Z")

</div>

Thank you, that did the trick nicely. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [July 4, 2023, 8:10pm UTC](https://community.traefik.io/t/route-tcp-to-an-sftp-server/19098/4 "2023-07-04T20:10:02Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
