Hi Devanshu Soni,
Given your environment (Next.js frontend, Node.js backend, hosted on Azure App Services), and the fact that you've already configured CORS on the backend, here are a few areas worth double-checking, especially when using Azure App Services and possibly Azure API Management (APIM):
- If Using Azure API Management (APIM):
CORS policies must be explicitly configured in APIM, as OPTIONS (preflight) requests often don’t reach the backend.
Please check your inbound policy in the APIM API definition and ensure it includes a <cors> block. lf CORS is only configured at the backend and not in APIM, the browser will block the response due to missing CORS headers on the preflight.
2.Azure App Service Specifics:
If you're directly calling the backend via App Service (and not via APIM), ensure:
- HTTPS is enforced on both frontend and backend (HTTPS Only enabled under TLS/SSL settings in App Service).
- No redirection occurs that may strip CORS headers.
You're calling the backend using the correct domain (e.g., https://your-api.azurewebsites.net or custom domain).
- Backend Node.js (Express) CORS Setup:
Ensure the CORS middleware is correctly set up and registered before your route handlers