Skip to content

Commit

Permalink
Test vercel headers
Browse files Browse the repository at this point in the history
  • Loading branch information
muliswilliam committed Sep 20, 2023
1 parent 6847948 commit decf1be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pages/api/ip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
})
}

console.log('x-vercel-forwarded-for' ,req.headers['x-vercel-forwarded-for'])
console.log('x-vercel-ip-country' ,req.headers['x-vercel-ip-country'])
console.log('x-vercel-ip-country-region' ,req.headers['x-vercel-ip-country-region'])
console.log('x-vercel-ip-city' ,req.headers['x-vercel-ip-city'])
console.log('x-vercel-ip-longitude' ,req.headers['x-vercel-ip-longitude'])
console.log('x-vercel-ip-latitude' ,req.headers['x-vercel-ip-latitude'])
console.log('x-vercel-ip-timezone' ,req.headers['x-vercel-ip-timezone'])

const response = await fetch('http://ip-api.com/json/')
const data = await response.json()
const { status, query, ...rest } = data
Expand Down

0 comments on commit decf1be

Please sign in to comment.