Skip to content

Commit d8e739b

Browse files
committed
fix the 127.0.0.1 self signed cert issue
1 parent 5053799 commit d8e739b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/dispatchRequest.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ 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') {
39+
// Only allow self signed certs on 127.0.0.1
40+
// and on node
41+
if (url.startsWith("https://127.0.0.1")
42+
&& typeof window === 'undefined') {
4243
const https = require('https')
4344
const agent = new https.Agent({
44-
rejectUnauthorized: true
45+
rejectUnauthorized: false
4546
})
4647
options.httpsAgent = agent
4748
}
@@ -94,6 +95,7 @@ function DispatchRequest(url, action, payload, local_auth, remote_auth = null) {
9495
.then(response => response.data)
9596
.catch(err => {
9697
let e = new Error(ErrorMessage.getAPIErrorMessage(url, options, err))
98+
console.log(err)
9799
if (err.response && err.response.data) {
98100
e.data = err.response.data
99101
}

0 commit comments

Comments
 (0)