Cant get cf-ipcountry with Nuxt App

Posted March 7, 2021 299 views

I’m using my Nuxt app with cloudflare to get users geo location country (cf-ipcountry) using a middleware. I’ve recently switched to DigitalOcean from Google Cloud App Engine and seems like I’m unable to request cf-ipcountry.

Do you guys have any idea why? Or how i can fix it?

Here’s a sample code:

export default async function ({ req,res }) {
  try {
        const loc = req.headers['cf-ipcountry']
        if (loc === undefined) {
        } else {
    catch (err) {

Checking the request headers in the DigitalOcean App Logs, I cant even see cf-ipcountry.

Would really appreciate any help.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!