Request header field x-access-token is not allowed by Access-Control-Allow-Headers in preflight response. CORS when trying on localhost

Comments

4 comments

  • Avatar
    Eric Pasos

    Hi Dika,

    The CORS error is encountered when you try to upload a file from your application's client-side code and the actual upload to your Media Library is done by the server-side implementation of your application. If you wish to upload the images at the client-side of your application, you should consider uploading the file directly from the browser as described in this link: https://cloudinary.com/documentation/upload_images#uploading_with_a_direct_call_to_the_rest_api

    Hope this helps.

    0
    Comment actions Permalink
  • Avatar
    dika

    This has nothing to do with any server-side thing

    I've followed the "uploading the file directly from the browser" method from the beginning but still getting that error

    0
    Comment actions Permalink
  • Avatar
    dika

    solved.

    somewhere in my code, there is Axios interceptor which creates a default header.

    my bad

    1
    Comment actions Permalink
  • Avatar
    Eric Pasos

    Hi Dika,

    Thanks for the feedback and for the details on the fix you've made, it is very useful.

    0
    Comment actions Permalink

Please sign in to leave a comment.