Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ export function getRequestIP(
if (opts.xForwardedFor) {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#syntax
const _header = event.req.headers.get("x-forwarded-for");
const xForwardedFor = (_header || "")?.split(",").shift()?.trim();
if (xForwardedFor) {
return xForwardedFor;
if (_header) {
const xForwardedFor = _header.split(",")[0].trim();
if (xForwardedFor) {
return xForwardedFor;
}
}
Comment thread
pi0 marked this conversation as resolved.
}

Expand Down