Detect whether a stream is https or http based on the first buffer on a stream and forward accordingly.
:4050 routing http traffic to
:4051 and https traffic to
var httpsDetect = ;;
Fire up http and https servers and route traffic to them based on what the incoming messages look like.
var httpsDetect = ;var http = ;var https = ;var fs = ;var opts =key : fscert : fs;var servers =http : httphttps : https;servershttp;servershttps;;
$ curl http://localhost:4050 I am an http server! $ curl -k https://localhost:4050 I AM TOTALLY SECURE AND STUFF YOU GUYS. SELF SIGNED IS TOTALLY SECURE, WHATEVER. $
var httpsDetect = ;
opts should have 2 keys:
- http - the http server
- https - the https server
host defaults to localhost for both keys.
If the option argument isn't an array it will be lifted to be
With npm, do:
npm install https-detect