This commit is contained in:
parent
e6b8175662
commit
29da0ce6a4
1 changed files with 3 additions and 10 deletions
|
@ -48,16 +48,9 @@ const postAnalytics = async (
|
||||||
server: Bun.Server,
|
server: Bun.Server,
|
||||||
) => {
|
) => {
|
||||||
const cfIp = req.headers.get("CF-Connecting-IP");
|
const cfIp = req.headers.get("CF-Connecting-IP");
|
||||||
const realIp = req.headers.get("X-Real-IP");
|
//const realIp = req.headers.get("X-Real-IP");
|
||||||
const forwardedIp = req.headers.get("X-Forwarded-For");
|
const forwardedIp = req.headers.get("X-Forwarded-For");
|
||||||
const serverIp = server.requestIP(req)?.address;
|
//const serverIp = server.requestIP(req)?.address;
|
||||||
|
|
||||||
console.log({
|
|
||||||
cfIp,
|
|
||||||
realIp,
|
|
||||||
forwardedIp,
|
|
||||||
serverIp,
|
|
||||||
});
|
|
||||||
|
|
||||||
return await fetch("https://plausible.creations.works/api/event", {
|
return await fetch("https://plausible.creations.works/api/event", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -65,7 +58,7 @@ const postAnalytics = async (
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"User-Agent": req.headers.get("user-agent") || "",
|
"User-Agent": req.headers.get("user-agent") || "",
|
||||||
"X-Forwarded-For": String(
|
"X-Forwarded-For": String(
|
||||||
cfIp || realIp || forwardedIp?.split(",")[0] || serverIp,
|
cfIp || forwardedIp?.split(",")[0],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
Loading…
Add table
Reference in a new issue