Update views.py to adapt headers based on REVERSE_PROXY_TYPE
This commit is contained in:
parent
0695cd85e1
commit
be7e8e1e7e
|
@ -238,9 +238,9 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
f.serve_from_source_path)
|
f.serve_from_source_path)
|
||||||
response = Response()
|
response = Response()
|
||||||
filename = f.filename
|
filename = f.filename
|
||||||
if settings.USE_APACHE_HEADERS:
|
if settings.REVERSE_PROXY_TYPE == 'apache':
|
||||||
response['X-Sendfile'] = file_path
|
response['X-Sendfile'] = file_path
|
||||||
else:
|
elif settings.REVERSE_PROXY_TYPE == 'nginx':
|
||||||
response['X-Accel-Redirect'] = file_path
|
response['X-Accel-Redirect'] = file_path
|
||||||
filename = "filename*=UTF-8''{}".format(
|
filename = "filename*=UTF-8''{}".format(
|
||||||
urllib.parse.quote(filename))
|
urllib.parse.quote(filename))
|
||||||
|
|
Loading…
Reference in New Issue