I am trying to call the REST API with PFX & PassPhrase, but each time I getting 'header too long' error. My certificate file size is 11kb. Below snippet is working fine for other REST API without pfx, but no success with pfx
var options = {
hostname: '<hostname>',
port: 443,
path: '/',
method: 'POST',
pfx: fs.readFileSync(<pfx file path>),
passphrase: '<passphrase>',
json: { 'Request': 'My Custom Req'}
};
var req = https.request(options, function (res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function (d) {
process.stdout.write(d);
});
});
req.end();
req.on('error', function (e) {
console.error(e);
});
I have ran my application with following command; but still problem persists:
node --max-http-header-size=819200 .\restPost.js
The REST API is perfectly working and I have tested the same using Postman and .NET Core web client solutions.
Need your help to fix the issue in NodeJS