Skip to content

Commit

Permalink
http page: handle x-forwarded-proto properly
Browse files Browse the repository at this point in the history
Signed-off-by: Yonle <yonle@lecturify.net>
  • Loading branch information
Yonle committed May 24, 2024
1 parent 014d469 commit d9d3b78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const favicon = fs.existsSync(config.favicon) ? fs.readFileSync(config.favicon)

server.on('request', (req, res) => {
const globalStat = bouncer.getStat("_global");
const serverAddr = `${req.headers["x-forwarded-proto"]?.replace(/http/i, "ws") || (server.isStandaloneHTTPS ? "wss" : "ws")}://${req.headers.host}${req.url}`;
const serverAddr = `${req.headers["x-forwarded-proto"]?.split(",")[0]?.replace(/http/i, "ws") || (server.isStandaloneHTTPS ? "wss" : "ws")}://${req.headers.host}${req.url}`;
log(`${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} - ${req.method} ${req.url} [${req.headers["user-agent"] || ""}]`)

if (req.headers.accept?.includes("application/nostr+json"))
Expand Down

0 comments on commit d9d3b78

Please sign in to comment.