Search code examples
node.jsexpressaxiosamazon-cloudfront

Accessing geolocked API using Node & Axios


I'm trying accessing the CoWIN API from an Express server that is deployed on Heroku - US region (I am a free user and they only provide access to US & EU regions in the free tier). The issue is that the API is deployed on CloudFront and is geofenced i.e., only accessible from an Indian IP. I have tried using a npm package that uses proxy but that requires my browser to be always connected to my server (not ideal). Is there a workaround (preferably free) that allows me to mock my server's IP or proxy or anything that bypasses this geofencing?


Solution

  • I had faced this same issue while DevOpsifying a vaccine notifier application using Express & Telegram API.

    Since Heroku free tier is only available in US & EU regions, I first switched to a Ubuntu Droplet on Digital Ocean (I chose the Bangalore Data Center) but this didn't work (using free credits). I am not sure why the calls to the API were blocked despite being an Indian IP.

    Finally, using AWS Free Tier creating an EC2 Instance in ap-south-1 Mumbai region WORKED!

    This is a simple workaround that worked for me, I would suggest you try this first. Other workarounds are complicated.