# Using Both http and tcp in traefik routing

**URL:** <https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544>\
**Category:** Traefik v2\
**Tags:** tcp\
**Created:** [May 5, 2021, 1:57pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544 "2021-05-05T13:57:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArcticStag](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@ArcticStag](https://community.traefik.io/u/ArcticStag)\
**Post date:** [May 5, 2021, 1:57pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/1 "2021-05-05T13:57:18Z")

</div>

Hey all,

I have not been using Traefik for long and I love its simplicity when it comes to adding SSL and TLS to my local homelab service web apps. It is great. My current issue is that I am trying to set this up so that the ssh traffic will route through to port 22 for SSH and the web traffic (Ports 80 and 443) will route their respectively. How can I manage this in my config.yml.

Thank you. Have a great day!

---

<div class="post-metadata">

**Author:** ![jakubhajek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jakubhajek/32/3389_2.png) [@jakubhajek](https://community.traefik.io/u/jakubhajek)\
**Post date:** [May 5, 2021, 2:06pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/2 "2021-05-05T14:06:11Z")

</div>

Hey @ArcticStag

You can just create the new entry point that listens on a specific port, e.g. 22, and then create a TCP router. All incoming request that matches the router should be forwarded to your SSH server.

Here are a few examples on that forum:

> [@Routing SSH traffic with Traefik v2](https://community.traefik.io/t/routing-ssh-traffic-with-traefik-v2/717):
>
> Is there a document on how to route such ssh traffic with traefik v2? many thanks!

Please refer also to the official documentation:

- Entrypoint: [Traefik EntryPoints Documentation - Traefik](https://doc.traefik.io/traefik/routing/entrypoints/)
- TCP router: [Traefik Routers Documentation - Traefik](https://doc.traefik.io/traefik/routing/routers/#configuring-tcp-routers)
- TCP service: [Traefik Services Documentation - Traefik](https://doc.traefik.io/traefik/routing/services/#configuring-tcp-services)

I hope that helps.

Thank you, Jakub

---

<div class="post-metadata">

**Author:** ![ArcticStag](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@ArcticStag](https://community.traefik.io/u/ArcticStag)\
**Post date:** [May 5, 2021, 2:13pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/3 "2021-05-05T14:13:34Z")

</div>

Thanks, This is great.

Currently I have this setup to route my HTTP traffic like so

```auto
http:
 #region routers 
  routers:
    proxmox:
      entryPoints:
        - "https"
      rule: "Host(`proxmox.home.arcticstagmedia.com`)"
      middlewares:
        - default-headers
      tls: {}
      service: proxmox

```

Then following this up with

```auto
#region services
  services:
    proxmox:
      loadBalancer:
        servers:
          - url: "https://10.0.0.20:8006"
        passHostHeader: true

```

Would I need to remove this and change the whole config to be a tcp config or can I mix and match routing?

---

<div class="post-metadata">

**Author:** ![jakubhajek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jakubhajek/32/3389_2.png) [@jakubhajek](https://community.traefik.io/u/jakubhajek)\
**Post date:** [May 5, 2021, 2:18pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/4 "2021-05-05T14:18:55Z")

</div>

hi @ArcticStag

You can extend the existing configuration by adding a new entry point for TCP and create the routing for the SSH server. The new configuration should works correctly together with HTTP / HTTPS.

Thank you, Jakub

---

<div class="post-metadata">

**Author:** ![ArcticStag](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@ArcticStag](https://community.traefik.io/u/ArcticStag)\
**Post date:** [May 5, 2021, 2:20pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/5 "2021-05-05T14:20:06Z")

</div>

I will try this out and see how I get on, Thank you!

🙂

---

<div class="post-metadata">

**Author:** ![jakubhajek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jakubhajek/32/3389_2.png) [@jakubhajek](https://community.traefik.io/u/jakubhajek)\
**Post date:** [May 5, 2021, 2:32pm UTC](https://community.traefik.io/t/using-both-http-and-tcp-in-traefik-routing/10544/6 "2021-05-05T14:32:09Z")

</div>

I am keeping fingers crossed 😉 Let us know what are the results! 🙂
