2021年3月20日星期六

Node - Change SSL certificate for an HTTPS Proxy server dynamically

I'm building an proxy (https) to a website in Node. Basically I'm allowing people to set a DNS CNAME alias to my proxy machine and import their SSL certificate into my application (like AWS Elastic Load Balancer does) so that their CNAME hostname is properly protected and recognized by the client on every request.

Now I'm working on the proxy side, and I'm trying to find a way to load the right certificate dynamically before the SSL handshake with the client. The workflow is:

1 - A new request is received by the server 2 - Get the hostname requested by the client (that is the DNS CNAME alias set by the user) 3 - Load the right certificate belonging to that hostname 4 - Use the loaded certificate in the current request 5 - Handshake (with the loaded certificate - which varies from request to request)

Currently I am stuck in the step 4.

I have no idea of how write this.

https://stackoverflow.com/questions/66728209/node-change-ssl-certificate-for-an-https-proxy-server-dynamically March 21, 2021 at 10:07AM

没有评论:

发表评论