Changed addRoute() to honor X-Forwarded-Host
This commit is contained in:
parent
d7909e8f56
commit
464e37c1c9
|
@ -100,7 +100,7 @@ function addRoute(app, uri, doc, opts) {
|
||||||
// know that header at the time the data is built.
|
// know that header at the time the data is built.
|
||||||
if (hasBasePath) {
|
if (hasBasePath) {
|
||||||
var headers = req.headers;
|
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
|
var protocol = headers['x-forwarded-proto'] || headers['X-Forwarded-Proto'] || opts.protocol || req.protocol
|
||||||
doc.basePath = protocol + '://' + host + initialPath;
|
doc.basePath = protocol + '://' + host + initialPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue