Hey, sorry for late reply, Have you tried what I said above?
You should point your react frontent to the Public exposed address of strapi, not to localhost.
Hey, sorry for late reply, Have you tried what I said above?
You should point your react frontent to the Public exposed address of strapi, not to localhost.
I asume you followed this tutorial ? Create a food ordering app with Strapi and Next.js (1)
As you said your frontend uses NEXT_PUBLIC_API_URL=http://localhost:1337
address for backend, this step was described in the Introduction chapter [1/7] and was configured ONLY for local development. On the last chapter of tutorial [7/7] you can notice that NEXT_PUBLIC_API_URL
was changed to the Public URL(Heroku URL for backend), I think you skipped that part and left the variable untouched.
Also, I’ve inspected your react code and found this:
const apiUrl = process.env.API_URL || 'http://localhost:1337';
Do you have configured API_URL
in env
? If no, then add it with url of the backend.