ElasticSearch Clustering authentication with Nginx

I have an ElasticSearch cluster with a master node on server 192.168.30.141 and 5 data nodes on some other servers. I have set up a nginx reverse proxy server on server 192.168.30.141 for basic authentication. My cluster data nodes can't discover master node. How can I resolve this problem? Is it necessary to install nginx on data nodes?

My ngnix configuration is as follow:
events { worker_connections 1024; } http { upstream elasticsearch { server 127.0.0.1:9200; } server { listen 9200; auth_basic "Protected Elasticsearch"; auth_basic_user_file passwords; location / { proxy_pass http://elasticsearch; proxy_redirect off; } } }

My master node configudarion is as follow:
node.master: true node.data: false network.host: 127.0.0.1 http.port: 9200

My data node configuration is as follow:
node.master: false node.data: true network.host: 192.168.30.142 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.30.141"] // master node ip

That's why, your master will never listen on anything other than the loopback address.

my master node just response to requests from proxy server.
upstream elasticsearch {
server 127.0.0.1:9200;
}
proxy server receives every request on port 9200 and after authentication send it to elasticSearch.
nginx (proxy server) and master node is installed on same server,