cnw
connect-no-www
npm i connect-no-www
cnw

connect-no-www

Simple no-www redirection as connect middleware

by Vincent Woo

0.1.2 (see all)TypeScript:Not Found
npm i connect-no-www
Readme

connect-no-www

Connect middleware to redirect clients from www.yourhost.com to yourhost.com

Usage:

npm install connect-no-www

nowww = require('connect-no-www');
nowww(secure); // returns middlware, true if https, false or optional otherwise

Example:

var connect = require('connect')
  , nowww = require('connect-no-www')
  , fs = require('fs')
  , options = {
      key: fs.readFileSync('ryans-key.pem'),
      cert: fs.readFileSync('ryans-cert.pem')
    };

// deduce from request (looks at req.connection.encrypted or forwarded header)
connect.createServer(
  nowww()
).listen(80);

// https always
connect.createServer(options,
  nowww(true)
).listen(443);

// http always
connect.createServer(
  nowww(false)
).listen(80);

Downloads/wk

12

GitHub Stars

10

LAST COMMIT

9yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.1.2
latest
9yrs ago
No alternatives found
No tutorials found
Add a tutorial