fix ip log issue, make changes to embed
Some checks failed
Code quality checks / biome (push) Failing after 11s
Some checks failed
Code quality checks / biome (push) Failing after 11s
This commit is contained in:
parent
23f37beef3
commit
b109f67125
2 changed files with 15 additions and 9 deletions
|
@ -225,17 +225,18 @@ class ServerHandler {
|
|||
);
|
||||
}
|
||||
|
||||
const headers: Headers = response.headers;
|
||||
let ip: string | null = server.requestIP(request)?.address || null;
|
||||
const headers = request.headers;
|
||||
let ip = server.requestIP(request)?.address;
|
||||
|
||||
if (!ip) {
|
||||
if (!ip || ip.startsWith("172.") || ip === "127.0.0.1") {
|
||||
ip =
|
||||
headers.get("CF-Connecting-IP") ||
|
||||
headers.get("X-Real-IP") ||
|
||||
headers.get("X-Forwarded-For") ||
|
||||
null;
|
||||
headers.get("CF-Connecting-IP")?.trim() ||
|
||||
headers.get("X-Real-IP")?.trim() ||
|
||||
headers.get("X-Forwarded-For")?.split(",")[0].trim() ||
|
||||
"unknown";
|
||||
}
|
||||
|
||||
|
||||
logger.custom(
|
||||
`[${request.method}]`,
|
||||
`(${response.status})`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue