question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when connection with https (self signed certificate)

See original GitHub issue

I’ve tried to debug this now for a couple of hours with no success. My elasticsearch-server is behind nginx using a self-signed-certificate. Everything works perfectly fine in any browser and with: curl -k https://user:pass@samehost.com When using this lib with settings below I get errors:

this.client = new elasticsearch.Client({
    host: {
        host: 'myhost.com',
        port: '443',
        protocol: 'https',
        auth: 'user:password'
    },
    log: {
     level: 'info'
    },
    keepAlive: true,
    apiVerison: "1.3"
});

Elasticsearch ERROR: 2014-10-21T19:42:24Z Error: Request error, retrying – self signed certificate

Elasticsearch WARNING: 2014-10-21T19:42:24Z Unable to revive connection: https://xxx:xxx@xxx/

Elasticsearch WARNING: 2014-10-21T19:42:24Z No living connections

Any ideas?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fractalfcommented, Oct 23, 2014

I debugged some more. From src/lib/http.js line 98-107:

  var reqParams = {
    method: params.method || 'GET',
    protocol: host.protocol + ':',
    auth: host.auth,
    hostname: host.host,
    port: host.port,
    path: (host.path || '') + (params.path || ''),
    headers: host.getHeaders(params.headers),
    agent: this.agent,
    rejectUnauthorized: false
  };

If I add reqParams.rejectUnauthorized = false; then all works out. I have now idea though how to pass this through the elasticsearch-js API, or if its even possible. Woulde be nice though, cause it’s a bit ugly to hack the source…

0reactions
kuezcommented, Nov 4, 2014

i’m using elasticsearch.jquery.js in Internet Explorer 9 and i have the same problem, the possible solution is enable the cross domain support like this:

jQuery.support.cors = true;

or


<!--[if lte IE 9]>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.0/jquery.xdomainrequest.min.js'></script>
<![endif]-->

Tnk!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Certificate error when connecting to SQL Server - Stack Overflow
I had the same error message ( Failed to connect to xxx:1433 - self signed certificate ). Then I used trustServerCertificate: true ....
Read more >
Resolving SSL Self-Signed Certificate Errors
This is caused by git not trusting the certificate provided by your server. Workaround. One possible workaround is to temporary disable SSL ......
Read more >
I get "Certificate is not trusted because it is self-signed" error ...
A self-signed certificate was installed on your server instead of the certificate issued by a Certificate Authority. You may check if your certificate...
Read more >
Self signed certificate" in Azure App Services - Microsoft Q&A
If the certificate on the remote service is a self-signed certificate or a private CA certificate, then it will not be trusted by...
Read more >
Self-Signed SSL Certificate Warning | InMotion Hosting
Self -signed SSL errors ... When you are trying to access a service such as WHM on your server, over the SSL (Secure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found