From f79c1e8e2daa36a6fd36e12b2a5cbf60f68686d6 Mon Sep 17 00:00:00 2001 From: skidoodle Date: Tue, 14 Feb 2023 11:15:31 +0100 Subject: [PATCH] Update ip.ts Signed-off-by: skidoodle --- pages/api/ip.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/api/ip.ts b/pages/api/ip.ts index c58f8c9..fa9fe2b 100644 --- a/pages/api/ip.ts +++ b/pages/api/ip.ts @@ -1,14 +1,14 @@ import { NextApiRequest, NextApiResponse } from 'next'; export default async function ip(req: NextApiRequest, res: NextApiResponse){ - let ip = req.headers['cf-connecting-ip']; - let continent = req.headers['cf-ipcontinent']; - let country = req.headers['cf-ipcountry']; - let city = req.headers['cf-ipcity']; + let ip = req.headers['x-vercel-forwarded-for']; + let region = req.headers['x-vercel-ip-country-region']; + let country = req.headers['x-vercel-ip-country']; + let city = req.headers['x-vercel-ip-city']; res.status(200).json({ ip: ip, city: city, country: country, - continent: continent + region: region }); -} \ No newline at end of file +}