Socket
Socket
Sign inDemoInstall

simples-redirect

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    simples-redirect

simpleS middleware to redirect connections


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Install size
3.91 kB
Created
Weekly downloads
 

Readme

Source

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

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

Keywords

FAQs

Last updated on 23 Apr 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc