0

I'm trying to make a REST call to a server that has restricted IP access. Therefore, I need to make the call from the client. To do so, I'm trying to use the XMLHttpRequest object within an HTML page loaded in the Google Sheet Sidebar. When I call XHR.send(), however, I always get an exception of the form:

"NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://some.host.com/'."

Does XMLHttpRequest not work within a google sheet sidebar? Is there an alternative?

Thanks.

2 Answers2

0

When you say that the server you're talking to has "restricted IP access" do you mean only whitelisted IP Addresses can call it? Have you added Google's servers to that whitelist?

This answer provides details:

Google App Engine - list of IP addresses?

As does the FAQ here

https://cloud.google.com/appengine/kb/

(see question "Static IP Addresses and App Engine apps").

Community
  • 1
  • 1
alfiethecoder
  • 343
  • 1
  • 2
  • 11
0

I've discovered that making XHR requests from the sidebar is in fact possible.

The problem I was running into was that the browser was blocking the request due to it being a cross-origin request. And, unfortunately, I'm not able to add google to the list of acceptable origins on the server I'm communicating with. So, I may be stuck for my particular use case.

  • Yes, indeed this is a CORS issue. The response returned from your server does not allow Cross domain request. check for the header "Access-Control-Allow-Origin" returned by your server when making a http request – Waqar Ahmad Aug 22 '16 at 04:01