http.js: Tell explicitly whenever client was connecting with https or http.

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle 2024-01-09 23:26:18 +07:00
parent 8863a73c65
commit 94d0e10eb2
2 changed files with 3 additions and 1 deletions

View File

@ -38,6 +38,8 @@ Or run in background with `tmux`:
tmux new -d "node index.js"
```
When configuring reverse proxy, Ensure that `x-forwarded-proto` header was set as `https`.
## Environment Variable
- `CLUSTERS` - Run Bostr with specified numbers of clusters.
- `LOG_ABOUT_RELAYS` - Whenever to log about relay connections

View File

@ -36,7 +36,7 @@ server.on('request', (req, res) => {
res.write(`\nI have ${wss.clients.size} clients currently connected to this bouncer${(process.env.CLUSTERS || config.clusters) > 1 ? " on this cluster" : ""}.\n`);
if (config?.authorized_keys?.length) res.write("\nNOTE: This relay has configured for personal use only. Only authorized users could use this bostr relay.\n");
res.write(`\nConnect to this bouncer with nostr client: ws://${req.headers.host}${req.url} or wss://${req.headers.host}${req.url}\n\n---\n`);
res.write(`\nConnect to this bouncer with nostr client: ${req.headers["x-forwarded-proto"]?.replace(/http/i, "ws") || "ws"}://${req.headers.host}${req.url}\n\n---\n`);
res.end(`Powered by Bostr (${version}) - Open source Nostr bouncer\nhttps://github.com/Yonle/bostr`);
} else if (req.url.startsWith("/favicon") && favicon) {
res.writeHead(200, { "Content-Type": "image/" + config.favicon?.split(".").pop() });