Skip to content

Commit

Permalink
Corrected addDynamicBasePathGetter() to honor x-forwarded-proto in or…
Browse files Browse the repository at this point in the history
…der to support reverse-proxy from https to http
  • Loading branch information
shelbys committed Jul 19, 2014
1 parent 2c1a042 commit c049f13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ function addDynamicBasePathGetter(remotes, path, obj) {
remotes.before(path, function (ctx, next) {
var headers = ctx.req.headers;
var host = headers.Host || headers.host;
var protocol = headers['x-forwarded-proto'] || headers['X-Forwarded-Proto'] || ctx.req.protocol

basePath = ctx.req.protocol + '://' + host + initialPath;
basePath = protocol + '://' + host + initialPath;

next();
});
Expand Down

0 comments on commit c049f13

Please sign in to comment.