TCP load balancing with domain name

Maxim Konovalov maxim at nginx.com
Thu Jun 21 08:39:37 UTC 2018


Aravind,

On 21/06/2018 11:35, aRaviNd wrote:
> Hi All,
> 
> I am trying to configure tcp load balancing with Nginx with below
> configuration.
> 
> stream {
>     server {
>         listen 25;
>         resolver 1.1.1.1;
>         proxy_pass $host:25;
>     }
> }
> 
> If I try to connect mx1.abc.com <http://mx1.abc.com> i would like to
> expand my variable $host to mx1.abc.com <http://mx1.abc.com> and
> internally it will resolve to servers who handles mail for that mx
> record.
> 
> Please let me know is there any nginx variable in stream which
> supports hostname i am connecting.
> 
This is simple not possible. TCP doesn't have any signs of the
original domain name that was used for connect(2) on the client side.

-- 
Maxim Konovalov


More information about the nginx mailing list