-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can use in Node.js with client certificate for security #159
Comments
Since axios supports global defaults, could you try doing something like this in your code: const fs = require('fs');
const https = require('https');
const axios = require('axios');
// ...
const httpsAgent = new https.Agent({
cert: fs.readFileSync('client.crt'),
key: fs.readFileSync('client.key'),
ca: fs.readFileSync('ca.crt'),
});
axios.defaults.httpsAgent = httpsAgent; |
options must pass as instance of http client. i think could be extra options that merge all axios options might be needed for any usecase. why not? however it's good to replace axios with native JS ecosystem fetch: for older browser: https:/github/fetch (just be part of document) <script>
if (!('fetch' in window)){
document.write('<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fetch.umd.min.js"></script>');
}
</script> many developer not care about older browser. could be enough |
Description
I need to full control client in nodejs. server could be behind nginx with mutual tls validation.
using
httpsAgent
Steps to reproduce
how can i add in Node.js ENV add
ca
client-cert
andclient-key
?Expected Behavior
axios client certificate supported fully
Actual Behavior
there is no documentation for that. Even in server hardening configuration.
The text was updated successfully, but these errors were encountered: