I am trying to get a Node https server accessed through a node proxy.
I bought certificates and got a standalone https server working fine. Initially there were some hiccups because of multiple certs in one file but this post helped:
http://stackoverflow.com/questions/16224064/running-ssl-node-js-server-with-godaddy-gd-bundle-crt.
Earlier I had all connections through a node-based reverse proxy nodejitsu's http-proxy module, which effectively proxied http -> http.
Now, as expected, after getting the target server changed to https, the proxy does not work as it is basically:
client -> http-proxy(public IP) -> https connection(local IP)
which is effectively the man-in-the-middle scenario which is what https seeks to eliminate.
Additionally, I got the following error from the https server:
Error: Hostname/IP doesn't match certificate's altnames
The certificates are just fine because https works well without the proxy in the middle. From reading some of the posts, I realized that the following should work:
client -> https-proxy (Public IP) -> http connection (local IP)
Where the actual local server is running http and the public https. This is based on the explanation in http-proxy documentation:
https://github.com/nodejitsu/node-http-proxy
and in this post:
https://nadeesha.silvrback.com/creating-a-https-proxy-in-node-js
In the http-proxy module documentation, there appears to be an explanation for a client -> https (proxy on public IP) -> https (proxy on local IP). If so, what certs do I need to set up on the target https server?
Before I try any of these possibilities, I would like to know: What are standard best-practices to handle this requirement and how to implement it/them under node. I do not want to introduce Nginx or Apache just for handling this. Am I totally off-track here?