Skip to content

Instantly share code, notes, and snippets.

@joshualyon
Last active August 2, 2019 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshualyon/97df0524942c6ff3ae8f371504a8da6e to your computer and use it in GitHub Desktop.
Save joshualyon/97df0524942c6ff3ae8f371504a8da6e to your computer and use it in GitHub Desktop.
dev_appserver fix for external reverse proxy hosts for Task Queues

dev_appserver fix for Task Queues behind proxy like ngrok

By default, it seems dev_appserver Task Queue handling does not work well behind a reverse proxy, like ngrok. This patch allows requests that don't match a host to still be processed.

Specifically, commenting out the raising of the ModuleDoesNotExistError and instead returning None for the _module and inst variables so the task can still be processed.

This is around line 816 in _resolve_target() in dispatcher.py in the 1.9.86 gcloud app Python Extensions:

\platform\google_appengine\tools\devappserver2\dispatcher.py
    else:
      if ':' in hostname:
        port = int(hostname.split(':', 1)[1])
      else:
        port = 80
      try:
        _module, inst = self._port_registry.get(port)
      except KeyError:
        # raise request_info.ModuleDoesNotExistError(hostname) # <--- comment me out
        _module, inst = None, None  # <--- add me in instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment