From 6aab6369c0f59ded6c4e8a23ecee7085bb366222 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Tue, 25 Sep 2018 23:34:26 +0200
Subject: [PATCH] Fixed broken nginx conf for federation

---
 docker/nginx/entrypoint.sh |  2 +-
 docs/upgrading/0.17.rst    | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/docker/nginx/entrypoint.sh b/docker/nginx/entrypoint.sh
index 9914a7aae..f359f4da9 100755
--- a/docker/nginx/entrypoint.sh
+++ b/docker/nginx/entrypoint.sh
@@ -9,7 +9,7 @@ if [ -n "$COMPOSE_PROJECT_NAME" ]; then
 fi
 echo "Copying template file..."
 cp /etc/nginx/funkwhale_proxy.conf{.template,}
-sed -i "s/X-Forwarded-Host \$host:\$server_port/X-Forwarded-Host ${FUNKWHALE_HOSTNAME}:${FORWARDED_PORT}/" /etc/nginx/funkwhale_proxy.conf
+sed -i "s/X-Forwarded-Host \$host:\$server_port/X-Forwarded-Host ${FUNKWHALE_HOSTNAME}/" /etc/nginx/funkwhale_proxy.conf
 sed -i "s/proxy_set_header Host \$host/proxy_set_header Host ${FUNKWHALE_HOSTNAME}/" /etc/nginx/funkwhale_proxy.conf
 sed -i "s/proxy_set_header X-Forwarded-Port \$server_port/proxy_set_header X-Forwarded-Port ${FORWARDED_PORT}/" /etc/nginx/funkwhale_proxy.conf
 sed -i "s/proxy_set_header X-Forwarded-Proto \$scheme/proxy_set_header X-Forwarded-Proto ${FORWARDED_PROTO}/" /etc/nginx/funkwhale_proxy.conf
diff --git a/docs/upgrading/0.17.rst b/docs/upgrading/0.17.rst
index 351013511..4a7093b1f 100644
--- a/docs/upgrading/0.17.rst
+++ b/docs/upgrading/0.17.rst
@@ -180,6 +180,7 @@ Libraries created this way will have a different visibility level depending of y
 This script will contain other database-related operations, but the impact will remain
 invisible.
 
+
 Upgrade instructions
 --------------------
 
@@ -195,3 +196,15 @@ On non docker-setups::
     python api/manage.py script migrate_to_user_libraries --no-input
 
 If the scripts ends without errors, you're instance should be updated and ready to use :)
+
+.. note::
+
+    If you use nginx, ensure your funkwhale_proxy.conf file does not contain this:
+
+        proxy_set_header X-Forwarded-Host $host:$server_port;
+
+    If you have this line present, replace it with:
+
+        proxy_set_header X-Forwarded-Host $host;
+
+    And reload your nginx server.
-- 
GitLab