I've been using this package to route connections to dozens of apps all over my server. Recently, I've been trying to add HTTPS to some of them. I managed to work out the following, which works: https://gist.github.com/DanH42/5836006
In that example, domain1.com is only available over plain HTTP, domain2.com and domain3.com use HTTPS with a custom certificate, and domain4.com uses a self-signed one. If SNI fails, the self-signed cert is served (I think; the documentation was somewhat unclear on that part).
I need to add another domain that will have to use WebSockets over SSL, and my application seems to be unhappy unless SSL is used end-to-end, meaning I need to add an HTTPS-to-HTTPS route in the proxy. However, the majority of my apps that use HTTPS on the outside still just use plain HTTP on localhost, and I'd like to keep it that way.
This means I need to be able to proxy HTTP, HTTPS-to-HTTP, and HTTPS-to-HTTPS, while using multiple certificates. I got as far as https://gist.github.com/DanH42/5836026 and am now stuck.
In that case, the new domain is domain5.com, which needs to use HTTPS-to-HTTPS. My main problem is that the target option seems to have to be provided directly to httpProxy.createServer rather than per-site.
Is what I'm trying to do even possible? Is there a better way? Any help would be greatly appreciated.
This is possible and will require multiple instances of http-proxy that you use within a single node process. Your code is based on the old version of http-proxy so if you still have an issue with the new version, please open an issue. Thanks!