aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-01-27 01:33:43 +0000
committerAdam Soltys <[email protected]>2026-01-27 17:41:34 +0000
commit6136f640456959e6471cbf7d41f6a44eed9671f1 (patch)
tree3ad268cabb300b476d400ff36e8ef3ff0f1e4914
parent197c75a02560ff153d73d3fe218fed312ccceaa4 (diff)
downloadcoinos-server-6136f640456959e6471cbf7d41f6a44eed9671f1.tar.gz
coinos-server-6136f640456959e6471cbf7d41f6a44eed9671f1.zip
ip fallback
-rw-r--r--lib/app.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/app.ts b/lib/app.ts
index bf208973..7632520f 100644
--- a/lib/app.ts
+++ b/lib/app.ts
@@ -45,9 +45,14 @@ app.addHook("preHandler", async (req) => {
if (ignore.some((path) => url.startsWith(path))) return;
if (req.method === "GET" && url.startsWith("/users")) return;
+ const xff = req.headers["x-forwarded-for"];
+ const forwardedIp = Array.isArray(xff) ? xff[0] : xff?.split(",")[0]?.trim();
+ const ip = req.headers["cf-connecting-ip"] || forwardedIp || req.ip;
+
reqLogger.info({
method: req.method,
url,
+ ip,
headers: req.headers,
query: req.query,
body: req.body,