From 5e727ec279539b71831a4b888589e0bd6e8c788f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 4 Aug 2024 14:55:22 +0200 Subject: [PATCH] Fix download URLs for Mastodon exports/archives See https://github.com/mastodon/mastodon/issues/24380 --- site-cookbooks/kosmos-mastodon/recipes/nginx.rb | 4 +++- .../kosmos-mastodon/templates/default/nginx_conf_shared.erb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/site-cookbooks/kosmos-mastodon/recipes/nginx.rb b/site-cookbooks/kosmos-mastodon/recipes/nginx.rb index bcb1d83..8188f2b 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/nginx.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/nginx.rb @@ -28,7 +28,9 @@ template "#{node['openresty']['dir']}/snippets/mastodon.conf" do owner 'www-data' mode 0640 variables web_root_dir: web_root_dir, - server_name: server_name + server_name: server_name, + s3_private_url: "#{node["kosmos-mastodon"]["s3_endpoint"]}/#{node["kosmos-mastodon"]["s3_bucket"]}/", + s3_public_url: "https://#{node["kosmos-mastodon"]["s3_alias_host"]}/" notifies :reload, 'service[openresty]', :delayed end diff --git a/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_shared.erb b/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_shared.erb index f996619..e42e07f 100644 --- a/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_shared.erb +++ b/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_shared.erb @@ -108,11 +108,13 @@ location @proxy { proxy_pass http://mastodon_app; proxy_buffering on; - proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; + # https://github.com/mastodon/mastodon/issues/24380 + proxy_redirect <%= @s3_private_url %> <%= @s3_public_url %>; + tcp_nodelay on; }