I have hosted my Strapi Application on AWS and I created a API and made it public when I test this API end point with postman I am getting a successful response with data being fetched from the strapi. However when I am trying to fetch the data from the NEXTJS using axios it is throwing me a CORS error.
The issue you are having is within the NextJS application, which appears to have provided a ‘same origin’ content security policy (CSP) header to the browser. This will prevent any ‘fetch’ on a resource URL that lies outside the origin of your app. (In your case, that appears to be ‘localhost’.)
Note that the ‘source’ is a local address, meaning if you were requesting to https://my-backend/api now you will request to /backend/api on your axios request