Skip to content

Commit

Permalink
fix: 在cloudflare cdn环境下获取ip不正确
Browse files Browse the repository at this point in the history
  • Loading branch information
MengNianxiaoyao authored Aug 3, 2024
1 parent b875de0 commit ad99ea5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/vercel/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,8 @@ async function createCollections () {

function getIp (request) {
try {
const { TWIKOO_IP_HEADERS } = process.env
const headers = TWIKOO_IP_HEADERS ? JSON.parse(TWIKOO_IP_HEADERS) : []
const TWIKOO_IP_HEADERS = process.env.TWIKOO_IP_HEADERS
let headers = TWIKOO_IP_HEADERS ? JSON.parse(TWIKOO_IP_HEADERS) : []
return getUserIP(request, headers)
} catch (e) {
logger.error('获取 IP 错误信息:', e)
Expand Down

0 comments on commit ad99ea5

Please sign in to comment.