Image upload error in Safari: Failed to load resource: Request header field Authorization is not allowed by Access-Control-Allow-Headers.

Open
#431 1 comment 0 reactions 2 assignees View on GitHub

@patrick-tolosa is already working on this.

Since Jan 24, 2021.

Assessment

This issue has not been assessed yet.

Description

Hi,
I'm getting an error Failed to load resource: Request header field Authorization is not allowed by Access-Control-Allow-Headers. in Safari, but not in Chrome using the following code for javascript upload. Is there anyway to fix this?

<%= cl_image_upload_tag(:image_id, :upload_preset => "logos", :public_id => "#{@account.id.to_s}") %>

<%= cloudinary_js_config %>

<script type="text/javascript">

    $('.progress').hide();

    $(document).ready(function() {
        if($.fn.cloudinary_fileupload !== undefined) {
            $("input.cloudinary-fileupload[type=file]").cloudinary_fileupload({
              maxFileSize: 10000000,
              acceptFileTypes: /(\.|\/)(jpe?g|png)$/i
            });
        }

        $('.cloudinary-fileupload').bind('cloudinarydone', function(e, data) {
            $('.logo-thumbnail').hide();
            $('.preview').html(
                $.cloudinary.image(data.result.public_id,
                    { format: data.result.format, version: data.result.version,
                        crop: 'fit', width: 500, height: 200 })
            );
            $('.image_public_id').val(data.result.public_id);
            return true;
        });

        $('.cloudinary-fileupload').bind('cloudinaryprogress', function(e, data) {
            $('.progress').show();
            $('.progress-bar').css('width', Math.round((data.loaded * 100.0) / data.total) + '%');
        });

    });

</script>
Dominant language
Ruby
Stars
420
Forks
282
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudinary/cloudinary_gem

All issues in cloudinary/cloudinary_gem

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.