How to call Local Proxy from Javascript policy

Not applicable

Hi All,

I am trying to call proxy2 in loop from proxy 1. For this I am using a Javacript Policy. Following is the code.

for(i=0; i<5 ; i++) {
  var geocoding = httpClient.get('http://myip:9001/proxy2/'+i);
  geocoding.waitForComplete();
  print(geocoding.getResponse().content);
}

But I am getting following error message-

Sorry, the page you are looking for is currently unavailable.

When I am using a public URL like googlemaps api url, it works fine.

But it is not working with the endpoint URL of my proxy2 hosted in same env.

Please help.

2 2 1,114
2 REPLIES 2

As far as I know, you cannot do that. The engineering team at Apigee is looking at making it possible to chain proxies from within JavaScript. But that feature is not yet available, and we haven't committed to making it available.

For now you need to take one of these approaches:

  • chain to local proxies with the ServiceCallout or with regular proxy targets (which means no looping), OR
  • build the remote proxy to handle a batch of requests, and invoke it just once from JS, OR
  • call to the other proxy from JS in a loop, using the external URL

Has there been any progress here? I am looking to make looped calls to proxies without having to call the backend/external URL.