We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db5ef0c commit 3245685Copy full SHA for 3245685
src/cs50/flask.py
@@ -42,5 +42,19 @@ def _after(*args, **kwargs):
42
logging.getLogger("cs50").disabled = disabled
43
SQL.execute = _after
44
45
+ # When behind CS50 IDE's proxy, ensure that flask.redirect doesn't redirect from HTTPS to HTTP
46
+ # https://werkzeug.palletsprojects.com/en/0.15.x/middleware/proxy_fix/#module-werkzeug.middleware.proxy_fix
47
+ if getenv("C9_HOSTNAME") and not getenv("IDE_OFFLINE"):
48
+ try:
49
+ import flask
50
+ from werkzeug.middleware.proxy_fix import ProxyFix
51
+ _before = flask.Flask.__init__
52
+ def _after(*args, **kwargs):
53
+ _before(*args, **kwargs)
54
+ self.wsgi_app = ProxyFix(self.wsgi_app, x_proto=1)
55
+ flask.Flask.__init__ = _after
56
+ except:
57
+ pass
58
+
59
except Exception:
60
pass
0 commit comments