How to change the IP address on each Heroku request?

1k views Asked by At

So I'm web scraping Google and am pretty sure it's blocking my requests based on the IP address. I've deployed my app to Heroku (which has dynamic IP addresses when the dynos restart) and I've noticed that if the app is up, after 5 requests, they stop being able to scrape properly. If I restart the dyne, then I get another 5 requests before it stops being able to scrape. This leads me to believe the static IP address when the dyno is up is the issue. I looked into QuotaGuard Dynamic IP's (https://devcenter.heroku.com/articles/quotaguard) but I don't think that will work because Google seems to be https. Has anyone dynamically proxied their requests through different IPs on Heroku before (if so, what do you recommend using)? I'm working in a Node.js environment.

1

There are 1 answers

2
Goh Kok Han On

Use proxies, there are tons of paid / free proxies. You can rotate the proxies on each requests. Do note that there are different types of proxies. DataCenter IPs, Residential IPs and the most expensive Mobile IPs.