Removing ssl-root-cas dep

This commit is contained in:
Chris Cowan 2015-02-02 12:25:30 -07:00
parent 5ab7cd18bd
commit 63740c6807
2 changed files with 5 additions and 11 deletions

View file

@ -56,8 +56,7 @@
"request": "^2.40.0",
"requirefrom": "^0.2.0",
"semver": "^4.2.0",
"serve-favicon": "~2.2.0",
"ssl-root-cas": "^1.1.7"
"serve-favicon": "~2.2.0"
},
"devDependencies": {
"connect": "~2.19.5",

View file

@ -12,14 +12,9 @@ var join = require('path').join;
// If the target is backed by an SSL and a CA is provided via the config
// then we need to inject the CA
var hasCustomCA = false;
var customCA;
if (/^https/.test(target.protocol) && config.kibana.ca) {
var sslRootCAs = require('ssl-root-cas/latest');
sslRootCAs.inject();
var ca = fs.readFileSync(config.kibana.ca, 'utf8');
var https = require('https');
https.globalAgent.options.ca.push(ca);
hasCustomCA = true;
customCA = fs.readFileSync(config.kibana.ca, 'utf8');
}
// Create the router
@ -59,8 +54,8 @@ router.use(function (req, res, next) {
options.headers['x-forward-proto'] = req.connection.pair ? 'https' : 'http';
// If the server has a custom CA we need to add it to the agent options
if (hasCustomCA) {
options.agentOptions = { ca: https.globalAgent.options.ca };
if (customCA) {
options.agentOptions = { ca: [customCA] };
}
// Only send the body if it's a PATCH, PUT, or POST