I have a Node.js-based deployment script for my application servers. One step in the deployment process is to validate that these application servers are listening on HTTPS correctly before registering them with DNS. To do that, I simply need to make an HTTPS request to that server's IP address.
If this were HTTP, it's a non-issue. I can make a HTTP GET
request for http://[2001:0db8::0370:7334]/
, and this will work. However, if I make an HTTPS GET request for https://[2001:0db8::0370:7334]/
, this will fail since the certificate is for a specific hostname like api.example.com
.
If I were testing manually, I would temporarily put the IP address in the hosts
file and cURL https://api.example.com
. However, in this automated process, I may be deploying several hosts at once so this isn't a solution for my deployment script.
How can I make an HTTPS request where I specify the hostname and IP address?
Perhaps there's some way to do this with a custom Agent?
I'm currently using node-fetch, but I'm happy to use whatever API is needed to make this work.
from HTTPS request, specifying hostname and specific IP address
No comments:
Post a Comment