Blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

Althaf
Althaf Member Posts: 3

When i upload image to cloudinary its show cors error. The error happening only when i hosted the backend server. Its perfectly worked in localhost


Answers

  • epasos
    epasos Member, Cloudinary Staff Posts: 21

    @Althaf When uploading files using Cloudinary SDK, the upload method supports different file source formats as described in this document. There is a possibility that the files are not accessible in the server environment through the PATH variable that you are using in your code (i.e., you could try using another format to verify).

  • Althaf
    Althaf Member Posts: 3
    edited September 2023

    @epasos When I was testing over http://localhost:**** (backend) to http://localhost:**** (frontend), it had no problems, but as soon as I deployed backend as HTTPS, GET method was working while POST was not working.

  • epasos
    epasos Member, Cloudinary Staff Posts: 21

    @Althaf While launching your application on a `localhost` environment, your application could have the privilege to access the resources of your localhost server. When deploying the application to a web server, depending on the host config, strict policies may be applied (i.e., it may be necessary to configure the web server environment). Could you please let us know which platform are you using for your web server?

  • Althaf
    Althaf Member Posts: 3

    @epasos I'm using react as frontend and nodejs as backend in my e-commerce app and my backend is hosted in Render.

  • epasos
    epasos Member, Cloudinary Staff Posts: 21

    @Althaf Thanks for the additional information, this document may be able to provide some insights about the limitations of the render.com platform. Hope this helps.