I’m using Nuxt.JS and host my Website on Vercel
I already tried things like this:
const response = await useFetch('https://api.ipify.org/?format=json');
const ipAddress = response.data._value.ip;
ipAddress.trim()
const details = await useFetch(`https://freeipapi.com/api/json/${ipAddress}`)
const countrycode = details.data._rawValue.countryCode
if(countrycode != 'CH' && countrycode != 'DE'){
await navigateTo('/restricted')
}
But then the IP-Address is the one from Vercel I think. But definitely not mine. And also the country code isnt the one from me (as a user on my website)