wsfed
Version:
WSFed server middleware
17 lines (14 loc) • 505 B
JavaScript
exports.escape = function(html) {
return String(html)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
exports.getBaseUrl = function(req) {
var protocol = req.headers['x-iisnode-https'] && req.headers['x-iisnode-https'] === 'on' ?
'https' :
(req.headers['x-forwarded-proto'] || req.protocol);
var host = req.headers['x-forwarded-host'] || req.headers['host'];
return protocol + '://' + host;
};