Description
A module for serving http and https connections over the same port.
Requirements
- node.js -- v0.10.0 or newer
Install
npm install httpolyglot
Examples
- Simple usage:
var httpolyglot = ;var fs = ; httpolyglot;
- Simple redirect of all http connections to https:
var httpolyglot = ;var fs = ; httpolyglot;
API
Exports
-
Server - A class similar to https.Server (except instances have
setTimeout()
from http.Server). -
createServer(< object >tlsConfig[, < function >requestListener]) - Server - Creates and returns a new Server instance.
How it Works
TLS and HTTP connections are easy to distinguish based on the first byte sent by clients trying to connect. See this comment for more information.