my server have 10 ip adress.
İp list 109.232.220.2 109.232.220.3 109.232.220.4 109.232.220.5 109.232.220.6 ...
How to use axios get or post with other ips on Nodejs ?
my server have 10 ip adress.
İp list 109.232.220.2 109.232.220.3 109.232.220.4 109.232.220.5 109.232.220.6 ...
How to use axios get or post with other ips on Nodejs ?
Here is my solution working both with https and IPV6
const https = require('https');
const getWrappedHttpsTransport = ({
localAddress,
...forceOptions
} = {}) => ({
...https,
request: (options, callback) => https.request({
...options,
...forceOptions,
...localAddress && {
localAddress,
family: localAddress.includes(':') ? 6 : 4,
},
}, callback),
});
Use it like that :
axios.create({
transport: getWrappedHttpsTransport({
localAddress,
}),
});