Skip to content

Commit a9318c3

Browse files
committed
Fix url wrong base if used with Express app.use()
If using Express 4 `app.use()` to mount certain routes paths, the req.url will be rewritten to reflect the mounted path. This has the effect of creating a wrong base resulting in an invalid computed signature. I changed to use `req.originalUrl` since it preserves the original path.
1 parent 18de16d commit a9318c3

File tree

1 file changed

+1
-1
lines changed
  • lib/passport-http-oauth/strategies

1 file changed

+1
-1
lines changed

lib/passport-http-oauth/strategies/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports.originalURL = function(req, defaultHost) {
2626
? 'https'
2727
: 'http'
2828
, host = defaultHost || headers.host
29-
, path = req.url || '';
29+
, path = req.originalUrl || '';
3030
return protocol + '://' + host + path;
3131
};
3232

0 commit comments

Comments
 (0)