mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
108536490: add the proxy_fix
This commit is contained in:
17
app/proxy_fix.py
Normal file
17
app/proxy_fix.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from werkzeug.contrib.fixers import ProxyFix
|
||||
|
||||
|
||||
class CustomProxyFix(object):
|
||||
def __init__(self, app, forwarded_proto):
|
||||
self.app = ProxyFix(app)
|
||||
self.forwarded_proto = forwarded_proto
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
environ.update({
|
||||
"HTTP_X_FORWARDED_PROTO": self.forwarded_proto
|
||||
})
|
||||
return self.app(environ, start_response)
|
||||
|
||||
|
||||
def init_app(app):
|
||||
app.wsgi_app = CustomProxyFix(app.wsgi_app, app.config.get('HTTP_PROTOCOL', 'http'))
|
||||
Reference in New Issue
Block a user