amazon-web-servicesamazon-s3fine-uploader

FineUploaderS3 (4.4) Accept Header in Firefox


I'm having a problem with FineUploader 4.4 in Firefox. As you know, Firefox sends the following HTTP accept header by default:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

But since AmazonS3 returns JSON data after I upload a file via POST with FineUploader, I need to override FineUploader to send an application/json Accept header:

 $('#demoUploader').fineUploaderS3({
                autoUpload: true,
                request: {
                    endpoint: "https://s3.amazonaws.com/myapp",
                    accessKey: "AKIAJ4VQLGW68A2Y6JLQ",
                    customHeaders: { 'Accept': 'application/json' }
                },
    ... etc

But this is not working. FineUploaderS3 ignores my customHeader option and still sends the default Accept header. What am I doing wrong?


Solution

  • Solved! Thanks @RayNicholus

    I had to add the customHeaders option to my uploadSuccess endpoint in order to force Firefox to send the application/json Accept header.

    uploadSuccess: {
        endpoint: "/api/amazons3/uploadSuccessful",
        customHeaders: { 'accept': 'application/json' }
    },