こんにちは。 マネーフォワード クラウドBox (以下MFCBox)というサービスを開発しています、RailsエンジニアのReoです。 MFCBoxはその名の通りストレージのマイクロサービスなのですが、ファイルの配信方法においてセキュリティと処理の負担軽減を考慮した結果、NGINXの機能である X-Accel-Redirect と AWSの署名バージョン 4 を利用することにしました。 X-Accel-Redirect こちらが、公式ドキュメントの概要説明です。 X-accel allows for internal redirection to a location determined by a header returned from a backend. This allows you to handle authentication, logging or whatever el
![S3のファイルをX-Accel-Redirectで配信する - Money Forward Developers Blog](https://cdn-ak-scissors.b.st-hatena.com/image/square/d6aa56915ed9cc60c2bea294849d29ab88d7fa97/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fm%2FmoneyforwardDev%2F20230119%2F20230119182344.png)