I'm developing an application in JAX-RS on a Heroku server but I've run into issues making calls to the Google Books API from the server. I've been using the Java libraries provided by Google to make these calls and on some occasions it works but for the most part it returns this error
403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Cannot determine user location for geographically restricted operation.", "reason" : "unknownLocation" } ], "message" : "Cannot determine user location for geographically restricted operation." }
I suspect that this issue is related to the dynamically generated IP address system Heroku uses for routing since the Google server is having issues detecting the origin of the API calls. How would I approach working around this? Is there any way for Heroku to use static IP addresses or could I use a proxy to act as the sole access point for the API?
Just realized that this can be resolved with adding a country code to the Google Books query (&country=US) or adding a x-forwarded-for header from the original HTTP request.
http://productforums.google.com/forum/#!topic/books-api/7FQ-622q-jI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With