diff --git a/changes/changelog.d/2252.bugfix b/changes/changelog.d/2252.bugfix new file mode 100644 index 000000000..0430f4dde --- /dev/null +++ b/changes/changelog.d/2252.bugfix @@ -0,0 +1 @@ +Fix broken nginx templates for docker setup (#2252) diff --git a/deploy/docker.proxy.template b/deploy/docker.proxy.template index 9bd8259e5..1d470b1b9 100644 --- a/deploy/docker.proxy.template +++ b/deploy/docker.proxy.template @@ -77,28 +77,6 @@ server { text/x-cross-domain-policy; # end of compression settings - - - location ~ ^/library/(albums|tracks|artists|playlists)/ { - include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-api; - } - - location /channels/ { - include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-api; - } - - location ~ ^/@(vite-plugin-pwa|vite|id)/ { - include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-front; - } - - location /@ { - include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-api; - } - location / { expires 1d; include /etc/nginx/funkwhale_proxy.conf; diff --git a/deploy/nginx.template b/deploy/nginx.template index 7789f4281..c77cb9335 100644 --- a/deploy/nginx.template +++ b/deploy/nginx.template @@ -105,7 +105,8 @@ server { location ~ ^/@(vite-plugin-pwa|vite|id)/ { include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-front; + alias ${FUNKWHALE_FRONTEND_PATH}/; + try_files $uri $uri/ /index.html; } location /@ { diff --git a/front/docker/funkwhale.conf.template b/front/docker/funkwhale.conf.template index a27024485..b7081f56d 100644 --- a/front/docker/funkwhale.conf.template +++ b/front/docker/funkwhale.conf.template @@ -72,7 +72,8 @@ server { location ~ ^/@(vite-plugin-pwa|vite|id)/ { include /etc/nginx/funkwhale_proxy.conf; - proxy_pass http://funkwhale-front; + alias /usr/share/nginx/html/; + try_files $uri $uri/ /index.html; } location /@ { diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index dc3cc2f52..ab8ea05d9 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -113,23 +113,20 @@ server { text/x-component text/x-cross-domain-policy; # end of compression settings - {% if not config.reverse_proxy %} + # headers add_header Content-Security-Policy "default-src 'self'; connect-src https: wss: http: ws: 'self' 'unsafe-eval'; script-src 'self' 'wasm-unsafe-eval'; style-src https: http: 'self' 'unsafe-inline'; img-src https: http: 'self' data:; font-src https: http: 'self' data:; media-src https: http: 'self' data:; object-src 'none'"; add_header Referrer-Policy "strict-origin-when-cross-origin"; add_header X-Frame-Options "SAMEORIGIN" always; add_header Service-Worker-Allowed "/"; -{% endif %} -{% if not config.reverse_proxy %} location /api/ { include /etc/nginx/funkwhale_proxy.conf; # This is needed if you have file import via upload enabled. client_max_body_size ${NGINX_MAX_BODY_SIZE}; proxy_pass http://funkwhale-api; } -{% endif %} location ~ ^/library/(albums|tracks|artists|playlists)/ { include /etc/nginx/funkwhale_proxy.conf; @@ -143,13 +140,23 @@ server { location ~ ^/@(vite-plugin-pwa|vite|id)/ { include /etc/nginx/funkwhale_proxy.conf; + {% if config.proxy_frontend %} proxy_pass http://funkwhale-front; + {% else %} + {% if config.inside_docker %} + alias /usr/share/nginx/html/; + {% else %} + alias ${FUNKWHALE_FRONTEND_PATH}/; + {% endif %} + try_files $uri $uri/ /index.html; + {% endif %} } location /@ { include /etc/nginx/funkwhale_proxy.conf; proxy_pass http://funkwhale-api; } +{% endif %} location / { expires 1d;