Reputation: 9217
https.request({
ip: '127.0.0.1',
hostname:'internal.hostname_required_for_certificate.com',
method: 'GET',
path: '/'
})
Above code doesn't work, meaning I need to send a request to 127.0.0.1 while in the request it is sending https://internal.hostname_required_for_certificate.com/
...
Upvotes: 1
Views: 2902
Reputation: 20394
You can manually specify a Host
header:
const req = https.request({
host: '127.0.0.1',
method: 'GET',
path: '/',
headers: {
'Host': 'internal.hostname_required_for_certificate.com'
}
}, (res) => {
res.setEncoding('utf8');
res.pipe(process.stdout);
});
req.end();
Upvotes: 1
Reputation: 1486
host/ip : A domain name or IP address of the server to issue the request to. Default: 'localhost'.
hostname Alias for host. To support url.parse(), hostname will be used if both host and hostname are specified.
Since you have provided both its taking hostname while processing get request
https://nodejs.org/api/http.html#http_http_request_options_callback
Upvotes: 0