|
|
|
@ -7,11 +7,14 @@ module.exports = function (middleware) {
|
|
|
|
|
var headers = {
|
|
|
|
|
'X-Powered-By': encodeURI(meta.config['powered-by'] || 'NodeBB'),
|
|
|
|
|
'X-Frame-Options': meta.config['allow-from-uri'] ? 'ALLOW-FROM ' + encodeURI(meta.config['allow-from-uri']) : 'SAMEORIGIN',
|
|
|
|
|
'Access-Control-Allow-Origin': encodeURI(meta.config['access-control-allow-origin'] || 'null'),
|
|
|
|
|
'Access-Control-Allow-Methods': encodeURI(meta.config['access-control-allow-methods'] || ''),
|
|
|
|
|
'Access-Control-Allow-Headers': encodeURI(meta.config['access-control-allow-headers'] || ''),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (meta.config['access-control-allow-origin']) {
|
|
|
|
|
headers['Access-Control-Allow-Origin'] = encodeURI(meta.config['access-control-allow-origin']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var key in headers) {
|
|
|
|
|
if (headers.hasOwnProperty(key) && headers[key]) {
|
|
|
|
|
res.setHeader(key, headers[key]);
|
|
|
|
|