0.0.4 • Published 9 years ago

simples-redirect v0.0.4

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
9 years ago

simples-redirect is a middleware to redirect connections to a specific protocol.

Recommended for simpleS 0.7+

Instalation

npm install simples-redirect

Usage

var simples = require('simples'),
    redirect = require('simples-redirect');

var server = simples();

server.middleware(redirect({
    headers: {
        'X-Powered-By': 'simpleS'
    },
    pattern: /^\/secured\/.*$/i,
    permanent: true,
    protocol: 'https'
}));

Options

headers : object - Headers to be set to the connection redirect, by default is an empty object

pattern : regexp or string - Regular expression pattern to match the redirected locations, by default is /^.+$/i

permanent : boolean - Set status code as 301 for permanent redirects and 302 - otherwise, by default is false

protocol: 'http' | 'https' - Set the prefered protocol to switch, by default is http

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

10 years ago

0.0.1

10 years ago