Skip to content

Commit c9cf2d0

Browse files
committed
Use x-forwarded-host as full url if set
1 parent 2ccf487 commit c9cf2d0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ module.exports.login = (apiKey, getUser, options = {}) => {
9191
}
9292

9393
if (!u) {
94-
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
94+
const domain = req.headers['x-forwarded-host'] || req.get('host');
95+
const fullUrl = `${req.protocol}://${domain}${req.originalUrl}`;
9596
return res.redirect(`${options.loginUrl}?redirect=${encodeURIComponent(fullUrl)}`);
9697
}
9798

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "readmeio",
3-
"description": "Track your API metrics within ReadMe",
3+
"description": "ReadMe.io integrations for Node",
44
"version": "0.0.0",
55
"dependencies": {
66
"configly": "^4.1.0",

0 commit comments

Comments
 (0)