mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 08:09:37 +00:00
15 lines
549 B
Python
15 lines
549 B
Python
from project import app
|
|
|
|
|
|
class ReverseProxied(object):
|
|
def __init__(self, app):
|
|
self.app = app
|
|
|
|
def __call__(self, environ, start_response):
|
|
# if one of x_forwarded or preferred_url is https, prefer it.
|
|
forwarded_scheme = environ.get("HTTP_X_FORWARDED_PROTO", None)
|
|
preferred_scheme = app.config.get("PREFERRED_URL_SCHEME", None)
|
|
if "https" in [forwarded_scheme, preferred_scheme]: # pragma: no cover
|
|
environ["wsgi.url_scheme"] = "https"
|
|
return self.app(environ, start_response)
|