2

I'm using the HTML5 download attribute to allow users to download a video file from S3:

<a href="https://mybucket.s3.amazonaws.com/video.mp4" download="video.mp4">Download</a>

This works perfectly in Chrome and IE. From the following question I understand that Firefox wants CORS to be enabled to allow download attribute to work cross origin:

HTML5 download attribute not working when downloading from another server, even when Access-Control-Allow-Origin is set to all (*)

I've enable CORS on my S3 bucket using the following technique:

http://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-cors-configuration.html

And this is my CORS policy:

<CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Firefox still doesn't want to download the video. Any help, tips or suggestions would be greatly appreciated. Thank you.

standac
  • 1,027
  • 1
  • 11
  • 26
  • what is the error do you get ? Please share a screen shot or copy and paste those errors. – Kannaiyan Oct 11 '17 at 22:47
  • When I click on the download link using Firefox, the mp4 video opens in a new tab instead of downloading. – standac Oct 12 '17 at 03:04

2 Answers2

0

Your CORS Policy is requiring an Authorization header. Change this to a wildcard.

In AllowedHeader change to <AllowedHeader>*</AllowedHeader>

John Hanley
  • 74,467
  • 6
  • 95
  • 159
0

There are couple of checks you need to do,

Make sure the content-type is application/octet-stream. By default it is the same unless you changed it.

Firefox handles mp4 files differently,

1. Enter about:config in the address bar
2. Hit Enter
3. Click I’ll be careful, promise!
4. In the Search field, enter media.windows-media-foundation.enabled
5. Double-click the True in the media.windows-media-foundation.enabled result to change it to False
6. Close the browser tab

Then firefox should download the file.

Reference:

https://jdrch.wordpress.com/2013/10/01/how-to-prevent-firefox-from-playing-direct-link-mp4-files-in-the-browser/

Hope it helps.

Kannaiyan
  • 12,554
  • 3
  • 44
  • 83
  • Thank you for you help. But asking all users to change their Firefox config is not an option. – standac Oct 19 '17 at 15:09