<div dir="ltr"><a href="https://www.nginx.com/blog/dns-service-discovery-nginx-plus/">https://www.nginx.com/blog/dns-service-discovery-nginx-plus/</a><br><div><br></div><div>Testing out the options provided in the above link. Specifically the "Setting the Domain Name in a Variable". The example given is L7 load balancing.</div><div><br></div><div>I have a need for L4 using upstream, yet I am not able to get this method to work (if it even does). The Note seems to indicate that it does by stating that this method is available in 1.11.3 of the Open source version.</div><div><br></div><div>The issue is around where to set the variable. I have tried setting it in the upstream block but that errors saying set is not valid in this context. Tried setting it in the stream context, same error.</div><div><br></div><div>I have also tried this on both Plus and open source and get the same errors on both.</div><div><br></div><div>Any insight would be helpful. Thanks</div><div><br></div><div>config:</div><div><br></div><div><div># TCP/UDP proxy and load balancing block</div><div>#</div><div>stream {</div><div>    proxy_protocol on;</div><div><br></div><div>    resolver 10.6.0.10 valid=10s;</div><div>    </div><div>    # Example configuration for TCP load balancing</div><div><br></div><div>    upstream stream_backend {</div><div>        zone tcp_servers 64k;</div><div>        server backend_servers:25 max_fails=3;</div><div>    }</div><div><br></div><div>    server {</div><div>        listen 25;</div><div>        status_zone tcp_server;</div><div>        proxy_pass stream_backend;</div><div>    }</div><div>}</div></div><div><br></div><div><br></div><div>So basically I need to replace server backend_servers with server $backend_servers but need to set that variable somewhere.</div><div><br></div></div>