chila
chila

Reputation: 2442

Problems using Go App Engine behind a proxy

I'm trying to run the example application hosted at: https://github.com/googlesamples/cloud-polymer-go, but when running it behind a proxy, I get the following errors:

$ goapp serve dispatch.yaml frontend/app.yaml backend/app.yaml
INFO     2015-10-13 13:04:19,461 devappserver2.py:763] Skipping SDK update check.
INFO     2015-10-13 13:04:19,526 api_server.py:205] Starting API server at: http://localhost:59441
INFO     2015-10-13 13:04:19,527 dispatcher.py:185] Starting dispatcher running at: http://localhost:8080
INFO     2015-10-13 13:04:19,529 dispatcher.py:197] Starting module "frontend" running at: http://localhost:8081
INFO     2015-10-13 13:04:19,534 dispatcher.py:197] Starting module "default" running at: http://localhost:8082
INFO     2015-10-13 13:04:19,534 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO     2015-10-13 13:04:23,859 module.py:786] frontend: "GET / HTTP/1.1" 304 -
INFO     2015-10-13 13:04:23,870 module.py:786] frontend: "GET /elements/post-list.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-service.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-form.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-card.html HTTP/1.1" 304 -
WARNING  2015-10-13 13:04:26,344 dispatcher.py:762] Skipping dispatch.yaml rules because /_ah/api/static/proxy.html is not a dispatchable path.
socket.error 101
Traceback (most recent call last):
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
    req.respond()
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
    self.server.gateway(self).respond()
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2117, in respond
    for chunk in response:
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 121, in __call__
    yield self.dispatch(request, start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 138, in dispatch
    start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 172, in dispatch_non_api_requests
    return dispatch_function(request, start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 212, in handle_api_static_request
    response, body = discovery_api.get_static_file(request.relative_url)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/discovery_api_proxy.py", line 113, in get_static_file
    connection.request('GET', path, None, {})
  File "/usr/lib/python2.7/httplib.py", line 979, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1013, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 797, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1178, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 101] Network is unreachable

The variables:

$ echo $http_proxy 
http://asusis-isa2.personal.com.py:8080/
$ echo $https_proxy 
http://asusis-isa2.personal.com.py:8080/

Are correctly set.

I works with a direct Internet connection.

I'm under Ubuntu 14.04.

Upvotes: 1

Views: 321

Answers (1)

Josh J
Josh J

Reputation: 6893

EDIT Looks like there is a defect in the SDK around using a proxy with URLFetch.

https://code.google.com/p/googleappengine/issues/detail?id=544

Try setting the uppercase versions of those environment variables, HTTP_PROXY and HTTPS_PROXY. The gcloud launcher requires them that way so I assume goapp does as well.

Using an HTTP proxy

If you are running gcloud preview app behind an HTTP proxy, you must tell gcloud preview app the name of the proxy. To set an HTTP proxy for gcloud preview app, set the http_proxy and https_proxy environment variables. Note that you must specify the full path for the app.yaml file.

Using Windows (in Command Prompt):

$ set HTTP_PROXY=http://cache.mycompany.com:3128
$ set HTTPS_PROXY=http://cache.mycompany.com:3128
$ gcloud preview app deploy DIRECTORY/app.yaml

Using the command line in Mac OS X (in Terminal) or Linux:

$ export HTTP_PROXY="http://cache.mycompany.com:3128"
$ export HTTPS_PROXY="http://cache.mycompany.com:3128"
$ gcloud preview app deploy DIRECTORY/app.yaml

Upvotes: 2

Related Questions