Socket
Book a DemoInstallSign in
Socket

connect-force-domain

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-force-domain

Connect Middleware to force visitors onto a single domain

0.1.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Connect Force Domain

Build Status

Inspired by Rack::ForceDomain it directs all traffic to a single domain with a 301 redirect.

This is useful where you are hosting your node site with a PaaS provide like Joyent or Nodester and want to ensure all visitors are on the same domain.

Installation

via npm

npm install connect-force-domain

Usage

For connect

var connect = require('connect'),
    http = require('http'),
    forceDomain = require('connect-force-domain');

var app = connect()
  .use(forceDomain('shapeshed.com'))
 
http.Server(app).listen(3000);

For express

var express = require('express'),
    forceDomain = require('connect-force-domain');

var app = module.exports = express.createServer();

app.configure(function(){
  app.use(forceDomain('shapeshed.com');
});

app.listen(3000);

FAQs

Package last updated on 13 Mar 2013

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.