0.1.1 • Published 10 years ago

httpls v0.1.1

Weekly downloads
8
License
-
Repository
github
Last release
10 years ago

TLS Server with HTTP Redirect

Put this in front of your app and HTTP requests will be redirected to their TLS equivalent.

Usage

var http = require('http'),
    httpls = require('httpls'),
    fs = require('fs');

var options = {
  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};

var app = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end("hello, secure world\n");
});
var server = httpls.createServer(options, app);
server.listen(1337);

What happen?

HTTP requests to the listening port will be served a 301 'moved permanently' redirect to the requested location with the scheme changed to https. All other URI attributes are preserved.

curl -I http://localhost:1337/
HTTP/1.1 301 Moved Permanently
Location: https://localhost:1337/
curl https://localhost:1337/
hello, secure world
0.1.1

10 years ago

0.1.0

10 years ago