My website, which is hosted on AWS EC2 allows files stored in AWS S3 to be downloaded. The download link is something like this.
<a href="https://example.s3.us-east-2.amazonaws.com/client/attachments/160/uBhl0qvQjfdYUN1j.docx" download="My_download_file"></a>
The link works, but the file is downloaded with the original filename (e.g. uBhl0qvQjfdYUN1j.docx). I want to download the file with a specified name, e.g. My_downlaod_file or My_download_file.docx. Specifying extension with "download" does not help:
<a href="https://example.s3.us-east-2.amazonaws.com/client/attachments/160/k8J98BYnmMyUnQlSkTYGKViEuBhl0qvQjfdYUN1j.docx" download="downloadfile.docx"></a>
However, when I use the a tag to download a file that is available on the server (my server on AWS EC2 as well as my local server on my Mac), it works:
<a href="images/COTA-HORIZONTAL-350px.png" download="my_download">AAAA</a>
The above code downloads COTA-HORIZONTAL-350px.png as my_download.png.
It appears that the issue is related to a file that is being downloaded from AWS S3. Is this anything to do with 'same-origin-policy' or AWS-S3 issue, or I am missing something?