Skip to content

Commit

Permalink
Merge pull request #17 from knownasilya/patch-4
Browse files Browse the repository at this point in the history
Don't assume headers.host is set, fixes #16
  • Loading branch information
edwardhotchkiss committed Jul 17, 2015
2 parents 9fab404 + b354e2b commit 2b0e779
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/subdomain.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ module.exports = function(options) {
// get host & protocol
var host = request.headers.host
, protocol = request.socket.encrypted ? 'https' : 'http';

// Invalid request, since headers.host should be set, most likely a malicious attempt
if (!host) {
return response.sendStatus(400);
}

// remove 'www' prefix from URL? (tacky, right?)
if (options.removeWWW === true) {
Expand Down

0 comments on commit 2b0e779

Please sign in to comment.