From 5879d2d65520a013e55311c98411e47221cca1fd Mon Sep 17 00:00:00 2001 From: Hazmo Date: Sun, 22 Apr 2018 11:08:57 +0000 Subject: [PATCH] Update views.py to modify headers depending on Nginx or Apache --- api/funkwhale_api/music/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py index d03b55e50..019525018 100644 --- a/api/funkwhale_api/music/views.py +++ b/api/funkwhale_api/music/views.py @@ -238,7 +238,10 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet): f.serve_from_source_path) response = Response() filename = f.filename - response['X-Accel-Redirect'] = file_path + if settings.USE_APACHE_HEADERS: + response['X-Sendfile'] = file_path + else: + response['X-Accel-Redirect'] = file_path filename = "filename*=UTF-8''{}".format( urllib.parse.quote(filename)) response["Content-Disposition"] = "attachment; {}".format(filename)