From be7e8e1e7e8078d93d86f5c45d1ad866f0515618 Mon Sep 17 00:00:00 2001
From: Hazmo <renon@disroot.org>
Date: Sun, 22 Apr 2018 11:59:41 +0000
Subject: [PATCH] Update views.py to adapt headers based on REVERSE_PROXY_TYPE

---
 api/funkwhale_api/music/views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py
index 0195250188..e2ff6a79e3 100644
--- a/api/funkwhale_api/music/views.py
+++ b/api/funkwhale_api/music/views.py
@@ -238,9 +238,9 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet):
                 f.serve_from_source_path)
         response = Response()
         filename = f.filename
-        if settings.USE_APACHE_HEADERS:
+        if settings.REVERSE_PROXY_TYPE == 'apache':
             response['X-Sendfile'] = file_path
-        else:
+        elif settings.REVERSE_PROXY_TYPE == 'nginx':
             response['X-Accel-Redirect'] = file_path
         filename = "filename*=UTF-8''{}".format(
             urllib.parse.quote(filename))
-- 
GitLab