Skip to content

Commit a6f9968

Browse files
dmytrirrooij
authored andcommitted
use https lib when running in node and accept self signed cert on loopback
1 parent 1fa7c0b commit a6f9968

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/dispatchRequest.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ function DispatchRequest(url, action, payload, local_auth, remote_auth = null) {
3636
// url:url,
3737
// no-referrer, *client
3838
}
39+
40+
if (!url.startsWith("https://127.0.0.1")
41+
&& typeof window !== 'undefined') {
42+
const https = require('https')
43+
const agent = new https.Agent({
44+
rejectUnauthorized: true
45+
})
46+
options.httpsAgent = agent
47+
}
48+
3949
if (local_auth && local_auth.type == 'basic') {
4050
let encoded = btoaImplementation(local_auth.user + ':' + local_auth.key)
4151
options.headers = {Authorization: `Basic ${encoded}`}

0 commit comments

Comments
 (0)