Not too long ago, I had this problem. We need to allow users to download json files hosted S3 through a signed URL, but the user on browser will see their json file rendered on the browser instead.
The behavior of whether a file to be downloaded or rendered on a browser is determined by Content-Disposition
response header. The default behavior on S3 is Content-Disposition: inline
. This tells the browser to render the content on the browser, but if it is a binary file then download.