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; }