solve not being able to correctly obtain CF IP

This commit is contained in:
wiresslend 2025-04-15 11:12:53 +08:00 committed by GitHub
parent 9446903c5b
commit 11fdaeeb19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ function blobs2logs(blobs: string[]) {
}
export function useAccessLog(event: H3Event) {
const ip = getHeader(event, 'x-real-ip') || getRequestIP(event, { xForwardedFor: true })
const ip = getHeader(event, 'cf-connecting-ip') || getHeader(event, 'x-real-ip') || getRequestIP(event, { xForwardedFor: true })
const { host: referer } = parseURL(getHeader(event, 'referer'))