Fetch self-signed websites

How can Cloudflare subdomian workers fetch pages from websites with self-signed certificates, instead of getting the “Invalid SSL certificate” error?

The node fetch API does not support non-validation of certificates, see

1 Like

I don’t get it. That page says that there is indeed an option in fetch that would make it accept unauthorized certs.
Is workers fetch not the same or is the issue creating the Agent object?
If the latter, can it be constructed manually, so that fetch accepts it? Can’t use require but got this page as reference: github.com/nodejs/node/blob/v19.2.0/lib/https.js

The workaround given on the issue uses the agent from the https package. You can try using the node_compat option for wrangler and making the agent with the https package, but the fetch API does not support the option to ignore invalid SSL natively.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.