New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-force-domain

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-force-domain - npm Package Compare versions

Comparing version

to
0.0.2

4

lib/express-force-domain.js

@@ -5,9 +5,5 @@ var url = require('url');

var force_host = url.parse(force_url).host;
console.log("force:");
console.log(force_host);
return function(req, res, next) {
var requested_host = req.header("host");
console.log('requested:');
console.log(requested_host);

@@ -14,0 +10,0 @@ if ( requested_host == force_host ) {

9

package.json
{
"name": "express-force-domain",
"version": "0.0.1",
"version": "0.0.2",
"description": "Force express 3.x to use a specific domain. Good for adding or removing www. and handling parked domains that redirect to your main domain.",
"main": "express-force-domain.js",
"main": "./lib/express-force-domain.js",
"scripts": {

@@ -19,3 +19,6 @@ "test": "echo \"Error: no test specified\" && exit 1"

"author": "Anthony Ettinger (chovy)",
"license": "MIT"
"license": "MIT",
"dependencies": {
"express": "3.x"
}
}

@@ -17,2 +17,3 @@ Express Force Domain

See the package on npm: https://npmjs.org/package/express-force-domain

@@ -24,4 +25,8 @@ Usage

app.all('*', require('express-force-domain')('http://www.example.com') );
or use config variable:
var cfg = require('./config');
app.all('*', require('./express-force-domain')(cfg.site_url) );
app.all('*', require('express-force-domain')(cfg.site_url) );

@@ -36,13 +41,13 @@ Alternative:

or you can pass the url for the homepage manually, (four examples):
or you can pass the url for the homepage manually, (four examples, pick one):
app.all('*', require('./express-force-domain')('http://example.com') );
app.all('*', require('./express-force-domain')('http://example.com:8080') );
app.all('*', require('./express-force-domain')('http://www.example.com') );
app.all('*', require('./express-force-domain')('http://www.example.com:8080') );
app.all('*', require('express-force-domain')('http://example.com') );
app.all('*', require('express-force-domain')('http://example.com:8080') );
app.all('*', require('express-force-domain')('http://www.example.com') );
app.all('*', require('express-force-domain')('http://www.example.com:8080') );
Parked domains, assuming example2.com points to the same ip as example.com, and you prefer your app live at http://www.example.com:
For parked domains you want to redirect, this assumes example2.com points to the same ip as example.com, and you prefer your app live at http://www.example.com:
app.all('*', require('./express-force-domain')('http://www.example.com') );
app.all('*', require('express-force-domain')('http://www.example.com') );

@@ -49,0 +54,0 @@ Requests for http://example2.com, http://www.example2.com, and http://example.com will all redirect to http://www.example.com.