Cant get cf-ipcountry with Nuxt App

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. Thanks!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted