Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option to ignore www subdomains (instead of redirecting) #9

Merged
merged 3 commits into from Jul 31, 2014

Conversation

jeddawson
Copy link
Contributor

Added an optional ignoreWWW parameter. When enabled, subdomain will ignore www subdomains without removing them and redirecting.

My use case for this is a web app that dynamically handles customer subdomains and routes www traffic.

Here's an example:

app.use(subdomain({base: 'basedomain.tld', ignoreWWW: true}));
app.get('/subdomain/:subdomain/', function(req,res,next){
     console.log(req.params.subdomain);
     //do something based on the subdomain
     next();
});
app.get('/', function(req,res,next){
   // either the base domain, or www subdomain
   next(); 
});

edwardhotchkiss added a commit that referenced this pull request Jul 31, 2014
Added an option to ignore www subdomains (instead of redirecting)
@edwardhotchkiss edwardhotchkiss merged commit 80ef0a3 into edwardhotchkiss:master Jul 31, 2014
@edwardhotchkiss
Copy link
Owner

Awesome @jeddawson: published.

@jeddawson
Copy link
Contributor Author

Thanks @edwardhotchkiss. If you'd like me to update the example in the readme or just add more info, I'd be happy to contribute to that as well.

@edwardhotchkiss
Copy link
Owner

@jeddawson that would be awesome, thanks!

@jeddawson jeddawson deleted the ignoreWWW branch August 12, 2014 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants