Skip to content

Commit

Permalink
Use custom hostname as bucket name
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBeale committed May 5, 2015
1 parent 89109a7 commit 600afc0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var app = function (hostname, port, directory, silent, indexDocument, errorDocum
logger = require('./logger')(silent),
Controllers = require('./controllers'),
controllers = new Controllers(directory, logger, indexDocument, errorDocument),
concat = require('concat-stream');
concat = require('concat-stream'),
path = require('path');

/**
* Log all requests
Expand All @@ -24,6 +25,17 @@ var app = function (hostname, port, directory, silent, indexDocument, errorDocum
}));
});

app.use(function(req, res, next) {
var host = req.headers.host.split(':')[0];

if (indexDocument && host !== 'localhost' && host !== '127.0.0.1')
{
req.url = path.join('/', host, req.url);
}

next();
});

app.disable('x-powered-by');

/**
Expand Down

0 comments on commit 600afc0

Please sign in to comment.