0

We have a Java 7 Google App Engine instance which we are trying to connect to an external API. Because the API server requires whitelisted IP addresses for access, we have set up a Google Compute Engine proxy server with Squid installed (a solution proposed elsewhere) and then whitelisted the external IP address of the proxy server on the API server.

This way, requests made from GAE will be redirected to GCE first, allowing API calls to be made. However, GAE requests are currently failing with the message:

 WARNING: Google App Engine does not support the use of proxies. 

Can anyone advise a solution?

1 Answers1

0

First of all, the Java 7 runtime is deprecated, so you should migrate to the Java 8 version. You can do it by specifying the Java 8 runtime in the appengine-web.xml file:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <runtime>java8</runtime>
  <threadsafe>true</threadsafe>
</appengine-web-app>

There are other features that will change with the migration to Java 8. All the changes are explained here.

Just in case the error comes because of some issue in the configuration, please make sure the instance you are using as a proxy is correctly configured (using Squid is ok). The firewall rules and access control lists should be correctly established, such as:

gcloud compute firewall-rules create [FIREWALL_RULE] --network [NETWORK] --allow tcp:3128

You should also set the proper access control entries by enabling them in the Squid config. Here are some examples:

sudo sed -i 's:#\(http_access allow localnet\):\1:' /etc/squid/squid.conf
sudo sed -i 's:#\(http_access deny to_localhost\):\1:'/etc/squid/squid.conf

If you follow this example you can test the correct use of an instance used as a proxy server.

There is a static class in Java called ApiProxy (com.google.apphosting.api) that can be used as a collection point for all calls from user code to the application server. Here you can find all the classes and methods related to it, as well as other classes related to ApiProxy.

Rodrigo C.
  • 1,114
  • 7
  • 13