Welcome! Log In Create A New Profile

Advanced

Load Balancing for a Wildcard DNS does not work

Posted by Weng 
Load Balancing for a Wildcard DNS does not work
May 14, 2019 06:06AM
I am trying to use NGINX as a load balancer for an Elastic Cloud Enterprise platform which consists of 3 VMs. The intention is to load balance a query e.g. http://xxxxxxx.ece.dev.org:9200 where xxxxxx refers to the Elasticsearch cluster and is variable depending on the elasticsearch cluster.

I have a wildcard DNS record which directs *.ece.dev.org to the NGINX IP
e.g. *.ece.dev.org -> 10.1.2.99

Then in the conf file, the server is defined as:

upstream ece-proxy{
server 10.1.2.3:9200; #these are the servers which host the platform
server 10.1.2.4:9200;
server 10.1.2.5:9200;
}

server{
listen 80;
server_name *.ece.dev.org;
location / {
proxy_pass http://ece-proxy;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
}

When I used the nginx configuration above, the URL http://xxxxxxxxxx.ece.dev.org:9200 was not able to connect.

If the wildcard DNS record directly resolves to one of the cloud VMs (e.g. *.ece.dev.org -> 10.1.2.3), then the URL is able to connect successfully.

(Directly entering 10.1.2.3:9200 or 10.1.2.4:9200 etc does not return anything. A cluster ID must be provided)

How should NGINX be configured to handle wildcard sub domains for load balancing?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 303
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready