Skip to content

Commit

Permalink
[Server] Fix bug
Browse files Browse the repository at this point in the history
Reject request that without 'Host' header
  • Loading branch information
syuilo committed Jan 7, 2017
1 parent ed18520 commit 8b273e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import vhost = require('vhost');
const app = express();
app.disable('x-powered-by');

// Reject request that without 'Host' header
app.use((req, res, next) => {
if (!req.headers.host) {
res.sendStatus(400);
} else {
next();
}
});

/**
* Register modules
*/
Expand Down

0 comments on commit 8b273e2

Please sign in to comment.