Skip to content

Instantly share code, notes, and snippets.

@wrunk
Created December 10, 2012 21:30
Show Gist options
  • Save wrunk/4253572 to your computer and use it in GitHub Desktop.
Save wrunk/4253572 to your computer and use it in GitHub Desktop.
Python WSGI Proxy
# A simple example of using the simple wsgiproxy as a nudge fallback app.
# We used this to proxy unfinished requests from appengine, back to our
# ec2 app
from nudge.publisher import ServicePublisher
from wsgiproxy.app import WSGIProxyApp
PROTO = 'http'
FALLBACK_HOST = 'example.com'
def proxy(environ, start_response):
app = WSGIProxyApp("%s://%s" % (PROTO, FALLBACK_HOST))
return app(environ, start_response)
# You would need to actually add some nudge endpoints here
endpoints = []
wsgi_app = ServicePublisher(
endpoints=endpoints,
fallbackapp=proxy
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment