Description
After following your documentation at
https://docs.joinmastodon.org/admin/optional/object-storage/
and
https://docs.joinmastodon.org/admin/optional/object-storage-proxy/
as part of maintaining an existing instance, we've missed to add a redirection from old URLs of media to new URLs which lead to multiple issues with federated instances failing to fetch images deployed prior to the move. As we have seen similar issues in opposite direction we might not have been the only ones who failed to consider that. Thus, I'd prefer having a proper remark on either page on how to fix the nginx configuration so that media queries are forwarded to the new URL.
In /etc/nginx/sites-enabled/mastodon-ssl, we have changed the location section for ^/system/ from
location ~ ^/system/ {
add_header Cache-Control "public, max-age=2419200, immutable";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
add_header Content-Security-Policy "default-src 'none'; form-action 'none'";
try_files $uri =404;
}
to
location ~ ^/system/ {
rewrite ^/system/(.*)$ https://name.of.our.s3-proxy.host/$1 permanent;
}
This might not be the best solution with regard to common remarks on preventing use of rewrite in nginx, but it works as a quick solution.