I'm using the fetch API to download files from within an Electron render process. The server provides a self-signed certificate.
Electron throws the following exception:
I do not want to turn of SSL/TLS entirely. Using process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
or setting the environment variable work, but this is completely insecure.
This is currently what I'm doing to fetch from the URL.
const requestInit: RequestInit = {
credentials: "include",
method: "GET"
};
const response = await fetch(url, requestInit);
You'll find that SSL/TLS is the protocol required to make a request to the URL you pass. If it is an 'https://' url, then try removing the s to make an 'http://' request. If the service does not support an SSL/TLS free option, then you'll have to support their choice to require SSL/TLS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.