How to fetch from an URL with a bad cert?
I have a test server provided to me that I need to communicate with during development, but it has an untrusted certificate. How do I make a request to it? Basically, I want
await fetch("https://untrusted-root.badssl.com/")
to work, right now the request fails with the status code 526.8 Replies
I don’t believe this is possible with workers. Node fetch requires the use of https module to ignore ssl errors and https module doesn’t exist in workers. https://github.com/orgs/nodejs/discussions/44038
GitHub
fetch() SSL disable certificate validation · nodejs · Discussion #4...
Hello, is there any way to disable SSL certificate validation for self-signed certificates or expired ones? Thank you.
Maybe it's possible to add a trusted root CA for a worker?
As far as I can tell, node only lets you load a CA certificate file with an environment variable and this variable points to a certificate file. You don’t get control over the SSL certificate store for workers so you’d be unable to add it to the system
I’m wondering, does it pull from the root store? If so, you could probably add the cert there?
Locally sure
Yeah, so that would work then? Going by their message above, the insecure test server would only be used in dev anyway
Ah maybe. I read that as the non prod server is using self signed so deployed workers using that need self signed
Well, I would still like to run it online for staging to be as close to a prod env as possible