Update ip.ts

Signed-off-by: skidoodle <contact@albert.lol>
This commit is contained in:
skidoodle 2023-02-14 11:15:31 +01:00 committed by GitHub
parent c66491ed96
commit f79c1e8e2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
});
}