# TCP hostname routing using SNI

**URL:** <https://www.ruby-forum.com/t/tcp-hostname-routing-using-sni/244804>\
**Category:** NGINX\
**Created:** [June 17, 2016, 11:48pm UTC](https://www.ruby-forum.com/t/tcp-hostname-routing-using-sni/244804 "2016-06-17T23:48:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [June 17, 2016, 11:48pm UTC](https://www.ruby-forum.com/t/tcp-hostname-routing-using-sni/244804/1 "2016-06-17T23:48:54Z")

</div>

We need TCP (not http) hostname routing for an environment we are  
creating  
using k8s and ingress with the nginx ingress controller. We are trying  
to  
figure out if there is a way to create an nginx server with a config  
that  
will route TCP calls to a single host:port to different host:port combos  
based on the hostname held in the SNI information.

Posted at Nginx Forum:

> **[TCP hostname routing using SNI](https://forum.nginx.org/read.php?2,267677,267677#msg-267677)**
>
> We need TCP (not http) hostname routing for an environment we are creating using k8s and ingress with the nginx ingress controller. We are trying to figure out if there is a way to create an nginx server with a config that will route TCP calls to a...

---

<div class="post-metadata">

**Author:** ![jordan.davidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@jordan.davidson](https://www.ruby-forum.com/u/jordan.davidson)\
**Post date:** [June 17, 2016, 11:54pm UTC](https://www.ruby-forum.com/t/tcp-hostname-routing-using-sni/244804/2 "2016-06-17T23:54:44Z")

</div>

On Fri, Jun 17, 2016 at 2:48 PM, jordan.davidson \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> We need TCP (not http) hostname routing for an environment we are creating  
> using k8s and ingress with the nginx ingress controller. We are trying to  
> figure out if there is a way to create an nginx server with a config that  
> will route TCP calls to a single host:port to different host:port combos  
> based on the hostname held in the SNI information.

This isn’t to say that there’s not a fully-formed module, but just  
wanted  
to point out that the nginx+lua extensions allow you to get at that  
information. And then you could presumably use the balancer-by-lua stuff  
to  
route.

---

<div class="post-metadata">

**Author:** ![jordan.davidson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a3d4f5/32.png) [@jordan.davidson](https://www.ruby-forum.com/u/jordan.davidson)\
**Post date:** [June 20, 2016, 8:44am UTC](https://www.ruby-forum.com/t/tcp-hostname-routing-using-sni/244804/3 "2016-06-20T08:44:31Z")

</div>

Hello,

On 6/18/16 12:48 AM, jordan.davidson wrote:

> We need TCP (not http) hostname routing for an environment we are creating  
> using k8s and ingress with the nginx ingress controller. We are trying to  
> figure out if there is a way to create an nginx server with a config that  
> will route TCP calls to a single host:port to different host:port combos  
> based on the hostname held in the SNI information.

Currently the stream (tcp/udp lb) module misses this feature.  
However, we do have it in the short-term roadmap and hope to have it  
implemented more or less soon.

–  
Maxim K.
