Skip to content

Commit

Permalink
Set protocol correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Feb 20, 2024
1 parent 3a4a509 commit 40b0468
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/middlewares/nip98Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export default function nip98Auth(customRule) {
);
}


if (req.headers['x-forwarded-proto'] === 'https') {
req.protocol = 'https';
let protocol = req.protocol;
if (req.headers["x-forwarded-proto"] === "https") {
protocol = "https";
}

const fullUrl =
`${req.protocol}` + "://" + `${req.get("host")}${req.originalUrl}`;
`${protocol}` + "://" + `${req.get("host")}${req.originalUrl}`;
const event = await nip98.unpackEventFromToken(authHeader);

try {
Expand All @@ -40,4 +40,4 @@ export default function nip98Auth(customRule) {
throw new AppError(UNAUTHORIZED_STATUS, `NIP-98: ${error.message}.`);
}
});
}
}

0 comments on commit 40b0468

Please sign in to comment.