Changed addRoute() to honor X-Forwarded-Host

This commit is contained in:
Shelby Sanders 2014-08-25 20:06:31 -07:00
parent d7909e8f56
commit 464e37c1c9
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ function addRoute(app, uri, doc, opts) {
// know that header at the time the data is built.
if (hasBasePath) {
var headers = req.headers;
var host = headers.Host || headers.host;
var host = headers['x-forwarded-host'] || headers['X-Forwarded-Host'] || headers.Host || headers.host;
var protocol = headers['x-forwarded-proto'] || headers['X-Forwarded-Proto'] || opts.protocol || req.protocol
doc.basePath = protocol + '://' + host + initialPath;
}