From f4fd6c3dae5672028861016c6f1e013bac2fd941 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 19 Jun 2015 09:33:15 -0600 Subject: [PATCH] Update README.md --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6d001c..a5c579f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,35 @@ -# node-redirect-https +# redirect-https + Redirect from HTTP to HTTPS using meta redirects + +```bash +npm install --save redirect-https +``` + +```javascript +var http = require('http'); +var server = http.createServer(); + +server.on('request', require('redirect-https')({ + port: 443 +, body: '' +})); +``` + +# Why meta redirects? + +When something is broken (i.e. insecure), you don't want it to kinda work, you want developers to notice. + +Using a meta redirect will break requests from `curl` and api calls from a programming language, but still have all the SEO and speed benefits of a normal `301`. + +```html + + + + + +``` + +# Other strategies + +If your application is properly separated between static assets and api, then it would probably be more beneficial to return a 200 OK with an error message inside