Skip to content

Commit

Permalink
wsgi.py: add credit to flask snippet, add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
dtkav committed Jan 9, 2019
1 parent 2708701 commit 3c936b1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions connexion/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# adapted from http://flask.pocoo.org/snippets/35/


class ReverseProxied(object):
'''Wrap the application in this middleware and configure the
reverse proxy to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what is used locally.
In nginx:
location /proxied {
proxy_pass http://192.168.0.1:5001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /proxied;
}
:param app: the WSGI application
:param script_name: override the default script name (path)
:param scheme: override the default scheme
:param server: override the default server
'''

def __init__(self, app, script_name=None, scheme=None, server=None):
self.app = app
Expand Down

0 comments on commit 3c936b1

Please sign in to comment.