totaljs/framework

How to ignore U.request() causing self signed certificate in certificate chain error.

DPain opened this issue · 3 comments

DPain commented

Hi, I'm testing total.js locally can noticed that my U.request() method has been causing self signed certificate error.
I thought setting NODE_TLS_REJECT_UNAUTHORIZED = 0 would fix the issue, but it doesn't.

I've been using axios as a temporary workaround by setting httpsAgent with a rejectUnauthorized: false flag.

Right now, I've just set the following before starting my app and it seems to work.
https.globalAgent.options.rejectUnauthorized = false;

Is there a way to set the httpAgent for individual U.request() methods?

Thanks, in advance!

Hi,
NODE_TLS_REJECT_UNAUTHORIZED must work, try to add allow_ssc_validation : false into the /config file.

I recommend to use Total.js v4:

var opt = {};
opt.url = 'https://yourlink.com';
opt.insecure = true;
opt.callback = function(err, response) {

	// response.headers {Object}
	// response.body {String/Object} a response body
	// response.status {Number} status code
	// response.host {String} resolved host name (opt.resolve = true returns IP address)
	// response.cookies {Object} response cookies (nullable)

};

REQUEST(opt);
DPain commented

Thanks! I'll try that out.

DPain commented

Yup that fixed the issue!
Thank you so much :)