Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Strand Lab
Strand Lab Cellxgene Gateway
Commits
94062c2d
Commit
94062c2d
authored
Jan 18, 2021
by
Gregor Sturm
Browse files
apply proxy fix
parent
068e8f76
Changes
1
Hide whitespace changes
Inline
Side-by-side
cellxgene_gateway/gateway.py
View file @
94062c2d
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment