Skip to content

Instantly share code, notes, and snippets.

@psenger
Last active November 19, 2023 00:24
Show Gist options
  • Select an option

  • Save psenger/efcdde5f27b743083eb5db41455acbfc to your computer and use it in GitHub Desktop.

Select an option

Save psenger/efcdde5f27b743083eb5db41455acbfc to your computer and use it in GitHub Desktop.
[ERR_TLS_CERT_ALTNAME_INVALID] #NodeJS

ERR_TLS_CERT_ALTNAME_INVALID indicates self signed TLS error.

Obsured by the following where xxxx.xxx.com can be a variety of host names.

Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:xxxx.xxx.com\",\"cause\":{\"reason\":\"Host: localhost. is not in the cert's altnames: DNS:xxxx.xxx.com,

Option one

This will work but is really bad. because every cert is ignored.

export NODE_TLS_REJECT_UNAUTHORIZED=0

Option two

The better solution, I Discovered that the headers had values that contridicted the url. I lost the details, but Im sure it was host

@Arslan-95

Copy link
Copy Markdown

I have the same error when i run npm install || yarn. But my problem is with codeload.github.com. And there is not error on my other computers. I tried install vpn, set github config sslverify to false and exc. But these didnt help me, and i cant find solution.

Host: codeload.github.com. is not in the cert's altnames: DNS:dns.google, DNS:dns.google.com

@psenger

psenger commented Nov 19, 2023

Copy link
Copy Markdown
Author

@Arslan-95 if you can not fix the headers of the host, and the certificate does not specify the correct host; you might be stuck with option one. I cant get to codeload.github.com, it bounces me. did a dns lookup on whois for codeload.github.com, so I know its there. The cert on github.com uses a splat...not sure what codeload.github.com's ssl looks like but the Github cert has *.github.com... can you use that cert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment