Merge pull request #160 from CartoDB/CDB-3678

[CDB-3678] Add X-Served-By-Host header
This commit is contained in:
Raul Ochoa 2014-07-30 13:17:28 +02:00
commit 4431e448b1
2 changed files with 4 additions and 0 deletions

1
app.js
View File

@ -29,6 +29,7 @@ if (ENV != 'development' && ENV != 'production' && ENV != 'test' && ENV != 'stag
// set Node.js app settings and boot // set Node.js app settings and boot
global.settings = require(__dirname + '/config/settings'); global.settings = require(__dirname + '/config/settings');
var env = require(__dirname + '/config/environments/' + ENV); var env = require(__dirname + '/config/environments/' + ENV);
env.api_hostname = require('os').hostname().split('.')[0];
_.extend(global.settings, env); _.extend(global.settings, env);
global.log4js = require('log4js') global.log4js = require('log4js')

View File

@ -481,6 +481,9 @@ function handleQuery(req, res) {
}; };
} }
if (global.settings.api_hostname) {
res.header('X-Served-By-Host', global.settings.api_hostname);
}
formatter.sendResponse(opts, this); formatter.sendResponse(opts, this);
}, },
function errorHandle(err){ function errorHandle(err){