mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-09-23 03:28:11 +08:00
apply proxy fix
This commit is contained in:
@@ -25,7 +25,7 @@ from flask import (
|
||||
)
|
||||
from flask_api import status
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
from cellxgene_gateway import env
|
||||
from cellxgene_gateway.backend_cache import BackendCache
|
||||
from cellxgene_gateway.cache_entry import CacheEntryStatus
|
||||
@@ -50,6 +50,7 @@ def _force_https(app):
|
||||
|
||||
|
||||
app.wsgi_app = _force_https(app.wsgi_app)
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
|
||||
|
||||
cache = BackendCache()
|
||||
location = f"{env.external_protocol}://{env.external_host}"
|
||||
@@ -149,11 +150,7 @@ def upload_file():
|
||||
if "file" in request.files:
|
||||
f = request.files["file"]
|
||||
if f and f.filename.endswith(".h5ad"):
|
||||
f.save(
|
||||
os.path.join(
|
||||
full_upload_path, secure_filename(f.filename)
|
||||
)
|
||||
)
|
||||
f.save(os.path.join(full_upload_path, secure_filename(f.filename)))
|
||||
return redirect("/filecrawl.html", code=302)
|
||||
else:
|
||||
raise CellxgeneException(
|
||||
@@ -166,21 +163,15 @@ def upload_file():
|
||||
status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
else:
|
||||
raise CellxgeneException(
|
||||
"Invalid directory.", status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
raise CellxgeneException("Invalid directory.", status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
return redirect(location, code=302)
|
||||
|
||||
|
||||
if env.enable_upload:
|
||||
app.add_url_rule("/make_user", "make_user", make_user, methods=["POST"])
|
||||
app.add_url_rule(
|
||||
"/make_subdir", "make_subdir", make_subdir, methods=["POST"]
|
||||
)
|
||||
app.add_url_rule(
|
||||
"/upload_file", "upload_file", upload_file, methods=["POST"]
|
||||
)
|
||||
app.add_url_rule("/make_subdir", "make_subdir", make_subdir, methods=["POST"])
|
||||
app.add_url_rule("/upload_file", "upload_file", upload_file, methods=["POST"])
|
||||
|
||||
|
||||
def set_no_cache(resp):
|
||||
|
||||
Reference in New Issue
Block a user