How to make request to HTTPS server with self-signed certificates
I know this is generally not advised for security reasons, but may be necessary if the server is running on a local network, such as the Pi-hole plugin for Stream Deck - see https://github.com/johnholbrook/streamdeck-pihole/issues/22#issuecomment-2733998302.
So far I haven't been able to find a way to connect to an HTTPS server and ignore self-signed certificates with XmlHttpRequest or the fetch API, but am wondering if this is possible somehow?
Hi @t1m0thyj,
I'm by no means an expert on this topic, so I'll leave the conversation open for other to contribute, but you might be able to try setting rejectAuthorization to false. It could look something like
const https = require("https");
const agent = new https.Agent({
rejectUnauthorized: false,
});
fetch("https://your-local-server.com/", { dispatcher: agent })
.then((response) => response.text())
.then((data) => {
streamDeck.logger.info(data);
})
.catch((error) => {
streamDeck.logger.error(error);
});
This issue was closed because it has been inactive for one week since being marked as stale.