Merge pull request #160 from CartoDB/CDB-3678
[CDB-3678] Add X-Served-By-Host header
This commit is contained in:
commit
4431e448b1
1
app.js
1
app.js
@ -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')
|
||||||
|
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user