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

Offen
#431 1 Kommentar 0 Reaktionen 2 zugewiesene Personen Auf GitHub ansehen

@patrick-tolosa arbeitet bereits daran.

Seit 24.1.2021.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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>
Vorherrschende Sprache
Ruby
Sterne
420
Forks
282
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cloudinary/cloudinary_gem

Alle Issues in cloudinary/cloudinary_gem

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.