mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-11 00:20:56 +08:00
#14 properly use the external protocol in 302 redirects
This commit is contained in:
@@ -37,6 +37,14 @@ from cellxgene_gateway.util import current_time_stamp
|
|||||||
from cellxgene_gateway.path_util import get_key
|
from cellxgene_gateway.path_util import get_key
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
def _force_https(app):
|
||||||
|
def wrapper(environ, start_response):
|
||||||
|
environ['wsgi.url_scheme'] = env.external_protocol
|
||||||
|
return app(environ, start_response)
|
||||||
|
return wrapper
|
||||||
|
app.wsgi_app = _force_https(app.wsgi_app)
|
||||||
|
|
||||||
cache = BackendCache()
|
cache = BackendCache()
|
||||||
location = f"{env.external_protocol}://{env.external_host}"
|
location = f"{env.external_protocol}://{env.external_host}"
|
||||||
|
|
||||||
@@ -151,7 +159,7 @@ def upload_file():
|
|||||||
"Invalid directory.", status.HTTP_400_BAD_REQUEST
|
"Invalid directory.", status.HTTP_400_BAD_REQUEST
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect(env.location, code=302)
|
return redirect(location, code=302)
|
||||||
|
|
||||||
|
|
||||||
if env.enable_upload:
|
if env.enable_upload:
|
||||||
|
|||||||
Reference in New Issue
Block a user