Search code examples
sslamazon-s3httpsfine-uploader

Uploading files to S3 via SSL/HTTPS using Fineuploader


I've set up Fineuploader to upload files to an S3 bucket for a project I'm working on and everything was running smoothly...until I set up SSL. (Application runs within Docker, and added Nginx + LetsEncrypt around that to achieve this)

While the rest of the application works fine, uploads via Fineuploader are failing with error message:

Mixed Content: The page at 'https://example.com/upload' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://MYBUCKETNAME.amazonaws.com/'. This request has been blocked; the content must be served over HTTPS.

I've looked through Fineuploader's documentation but see no options covering requests over HTTPS other than the mention that "SSL is also supported" under request>endpoint [https://docs.fineuploader.com/api/options-s3.html#request].

(There was also a feature suggestion which seems to tackle this that went through but was then reverted for some reason - https://github.com/FineUploader/fine-uploader/issues/1119)

I've tried adding "https://" in front of my endpoint within the client-side uploader but that hasn't worked either.

var uploader = new qq.s3.FineUploader({
     request: {
         endpoint: 'https://MYBUCKETNAME.amazonaws.com',
         accessKey: 'TRALALALALALA',
      },
...

Are there any options I'm missing here? Does the signature functionality need to change for this to work?

As this is an upload to an S3 bucket, does the endpoint policy depend on the bucket's permissions (in which case, how do you go about enabling uploads over https?)


Solution

  • I've just resolved this and turns out it was a Docker issue... For some reason the image wasn't being updated despite having the right tag. I've tried changing the endpoint by tacking 'https://" to the front of it and it's now working.

    (Similar to the recommendation in Using FineUploader with optional https? )

    Hope this helps others as the Fineuploader doesn't make this clear.