diff --git a/lib/swagger.js b/lib/swagger.js index ab7bfaf..ef9a1dc 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -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; }