Nginx proxy issues


(Warner Onstine) #1

We setup our ES server on EC2 using the chef setup described here:
http://www.elasticsearch.org/tutorials/deploying-elasticsearch-with-chef-solo/

We setup auth to it and then tried to use the elasticsearch-js client to
connect to it and thus began our problems.

At first it wasn't clear what was going on but after some digging
determined that the client wasn't sending 'Content-Length' of 0 when
posting, deleting, etc. to this version of nginx (1.1.19). Apparently this
is only required on older versions of nginx.

I patched the http.js file so that it would send the content-length of 0 to
get around this problem (around line 168):
if (params.body) {
request.setHeader('Content-Length', Buffer.byteLength(params.body,
'utf8'));
request.end(params.body);
} else {
if (reqParams.method === 'POST' || reqParams.method === 'PUT' ||
reqParams.method === 'DELETE') {
//olderversions of nginx really want this.
request.setHeader('Content-Length', 0);
}
request.end();
}

Then our second issue started as we had just configured this server up with
ssl to secure the basic auth we were using (as described in the chef doc
above) and we started getting this message from nginx:
The plain HTTP request was sent to HTTPS port

If I switch everything back to 8080 and plain http it works. I have a
different ES client that I can use successfully to connect to the server
over https so I know that isn't the issue. From what I can tell in the code
it should be sending it to the proper port unless I'm missing some config
option somewhere.

Here's my host info:
var client = new elasticsearch.Client({
hosts: [{
protocol: 'https',
host:'myserver.com',
port: 8443,
auth:'user:password'
}],
log: 'trace'
});

Anyone else run into this? Easy fix? Maybe? :slight_smile:

Thanks in advance!

-warner

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAJNTuMDEGjUGNv%2BgRNJW-Y5dkMYBTzQ89hrGp2HK6sA_S7bbuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2