Read from $NODE_EXTRA_CA_CERTS instead of server.https? #19531
-
Hi. I am dealing with local TLS certs and I am probably just a bit confused on how all this works, but here goes: I am using mkcert to generate a local CA for development certificates. All developers will run a script that adds this CA + generates the certificates locally. This works great e.g. for C# which automatically trusts any certificate that is in the system store. Unfortunately Node.js doesn't do this automatically1 so I need to set However, vite does not seem to respect the I know about export default defineConfig({
// ...
server: {
// ...
https: {
ca: "C:/Path/To/rootCA.pem"
}
}
]); This still doesn't seem to work, when I open Chrome it says What DOES work however, is if I set export default defineConfig({
// ...
server: {
// ...
https: {
cert: "C:/Path/To/cert.pem",
key: "C:/Path/To/cert-key.pem"
}
}
]); But I don't want to have to specify the keys specifically, I wish it would just automatically trust my local CA and listen to the Footnotes
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think I am confusing two concepts, servers need to present certs/keys and clients need to validate outgoing HTTPS requests with system CAs. So I probably want the cert/key here, and the I still need NODE_EXTRA_CA_CERTS for some other Node.js projects I have, unrelated to vite, since they acts as clients in those cases. I just figured "both are Node.js, why would it be different", but clearly they are doing different things. |
Beta Was this translation helpful? Give feedback.
I think I am confusing two concepts, servers need to present certs/keys and clients need to validate outgoing HTTPS requests with system CAs. So I probably want the cert/key here, and the
NODE_EXTRA_CA_CERTS
is irrelevant. The client code in the browser does the outgoing HTTPS requests which doesn't have to do with vite, that's why it works here.I still need NODE_EXTRA_CA_CERTS for some other Node.js projects I have, unrelated to vite, since they acts as clients in those cases. I just figured "both are Node.js, why would it be different", but clearly they are doing different things.