fetch https 127.0.0.1 throws pages err
I have a pages function that is making a fetch request :
My localhost https server certs were installed using https://github.com/FiloSottile/mkcert
I have verified that the server is working using firefox, chrome, and curl.
How can I get my pages function to recognize these certificates?
GitHub
GitHub - FiloSottile/mkcert: A simple zero-config tool to make loca...
A simple zero-config tool to make locally trusted development certificates with any names you'd like. - GitHub - FiloSottile/mkcert: A simple zero-config tool to make locally trusted develo...
8 Replies
I don't think Wrangler has a way to trust an untrusted cert. You could probably add to your system chain
I believe you can set the
NODE_EXTRA_CA_CERTS
env var - at least with default wrangler
anyway.oh yeah
NODE_EXTRA_CA_CERTS
is better than systemI'm not entirely certain if that will propagate to
pages dev
, but it's worth a tryMiniflare doesn't do any trust verification itself
it should just be undici
so should be fine
Fingers crossed. https://nodejs.org/api/cli.html#node_extra_ca_certsfile is probably the best reference for that.
It may also be possible to use
NODE_OPTIONS=--use-openssl-ca
as suggested by https://stackoverflow.com/a/68135600/1129543Stack Overflow
ssl certificate generated by mkcert is not a full chain
I am using mkcert to generate a self signed certificate for localhost.
mkcert -install
mkcert localhost
This works fine for the browser but if I try and and do a fetch from node, I get this error:
However, when I try this, I get: