Socket
Socket
Sign inDemoInstall

http2s

Package Overview
Dependencies
12
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    http2s

HTTP to HTTPS redirection service


Version published
Maintainers
1
Created

Readme

Source

http2s

Redirect HTTP requests to HTTPS

Installation

Install with npm (https://www.npmjs.com/package/http2s)

npm install http2s

Usage

http2s([options,] [callback])

Calls callback(err, activeSettings) on done

CLI usage

Command line usage (requires global install npm install --global http2s)

http2s [httpPort] [hostname]

Listens on http://hostname:httpPort/* and 302 redirects all requests to https://hostname/.

Options

Below options are the default values

var settings = {
  // http port to listen to
  http: 80,
  // https port to redirect to
  https: 443,
  // server hostname to bind http server to
  hostname: 'localhost',
  // automatically redirect
  auto: true,
  // http status code to use for automatic redirect
  redirectStatus: 302,
  // false or '/path/to/page' to redirect all requests to
  singleTarget: false,
  // html message format to print to clients
  message: 'Perhaps you are looking for ' +
           '<a href="%s" target="_self">the HTTPS site</a>?',
  // mime content type to use for message
  messageType: 'text/html',
  // http status code to use when showing message
  messageStatus: 404,
  // error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5
  logLevel: 2
};

Examples

If you are using port numbers >1000 because of permission issues, listen to that port instead.

http2s({
  hostname: 'localhost',
  http: 8080
});

License

Licensed under Creative Commons CC0 1.0 Universal. All rights waived. See LICENSE for more information.

Disclaimer

Use at own risk.

Keywords

FAQs

Last updated on 14 Feb 2016

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