Skip to content

Commit 10f6b05

Browse files
Niall O'Higginsindexzero
Niall O'Higgins
authored andcommitted
add support for loading CA bundles
fix loop typo another typo *sigh* this wasn't doing what I thought it was doing.
1 parent 2c36507 commit 10f6b05

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: bin/node-http-proxy

+12-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,21 @@ if (argv.config) {
4545
}
4646

4747
//
48-
// If `config.https` is set, then load those files into the config options.
48+
// If `config.https` is set, then load the required file contents into the config options.
4949
//
5050
if (config.https) {
5151
Object.keys(config.https).forEach(function (key) {
52-
config.https[key] = fs.readFileSync(config.https[key], 'utf8');
52+
// If CA certs are specified, load those too.
53+
if (key === "ca") {
54+
for (var i=0; i < config.https.ca.length; i++) {
55+
if (config.https.ca === undefined) {
56+
config.https.ca = [];
57+
}
58+
config.https.ca[i] = fs.readFileSync(config.https[key][i], 'utf8');
59+
}
60+
} else {
61+
config.https[key] = fs.readFileSync(config.https[key], 'utf8');
62+
}
5363
});
5464
}
5565

0 commit comments

Comments
 (0)