Commit 94062c2d authored by Gregor Sturm's avatar Gregor Sturm
Browse files

apply proxy fix

parent 068e8f76
......@@ -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"):
full_upload_path, secure_filename(f.filename)
), secure_filename(f.filename)))
return redirect("/filecrawl.html", code=302)
raise CellxgeneException(
......@@ -166,21 +163,15 @@ def upload_file():
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"])
"/make_subdir", "make_subdir", make_subdir, methods=["POST"]
"/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):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment