Prevent s3 file download






















Public Pastes. JSON 11 min ago 2. JSON 11 min ago 3. JSON 12 min ago 2. Python 14 min ago 1. Python 14 min ago 0. Therefore, we can reduce this problem to simply specifying the Content-Disposition header at the same time. It is actually fairly easy, although it took me a while to figure out precisely what we needed to do. We have an endpoint in the app which generates this URL, passes it back to the client, which in turn attempts to upload the file the user selected to this URL.

In addition to specifying the uploaded filename, and the HTTP method, you can also add signed headers. Therefore we must send the headers along with the request.

We use jQuery on the front-end to create the request for the presigned URL, and can now use it to perform the upload itself:.

The really important part and the part that I missed was that I needed to specify the Content-Disposition header both to the URL signer, and at upload time. I like AWS a lot—and we use a lot of their services. CloudFront is not required to deliver HLS videos. You cannot use S3 policy to prevent download because user must download to view it. S3 also does not support streaming. User can stream videos via Cloudfront URLs.

Read this for more detail. The first option is very easy to implement and is supported by just about every mobile device and desktop. All you need to do is to put your content in an S3 bucket and create a CloudFront distribution that points to the bucket. CloudFront will serve the video from its cache, fetching it from the S3 bucket if it is not already cached. This option has a couple of downsides. Skipping ahead or fast-forwarding also necessitates downloading of content that may never be seen.

How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Improve this answer. John Rotenstein k 17 17 gold badges silver badges bronze badges. Mark B Mark B k 23 23 gold badges silver badges bronze badges.

Jeremiah Heller Jeremiah Heller 71 2 2 bronze badges. Hesham Amin Hesham Amin 4 4 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast An oral history of Stack Overflow — told by its founding team.



0コメント

  • 1000 / 1000