Skip to content

Commit

Permalink
fix: include proxy url in 401 responses (#2464)
Browse files Browse the repository at this point in the history
  • Loading branch information
tripodsan authored Dec 11, 2024
1 parent c1130d1 commit 3cdb533
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/server/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,20 @@ window.LiveReloadOptions = {
.send(textBody);
return;
}
if (ret.status === 401) {
let textBody = await ret.text();
textBody = `<html>
<head><meta property="hlx:proxyUrl" content="${url}"></head>
<body><pre>${textBody}</pre></body>
</html>
`;
respHeaders['content-type'] = 'text/html';
res
.set(respHeaders)
.status(ret.status)
.send(textBody);
return;
}

if (ctx.log.level === 'silly') {
ctx.log.trace(`[${id}] <<<--------------------------`);
Expand Down

0 comments on commit 3cdb533

Please sign in to comment.