how to off(or on???) CORS in Next js
Unanswered
Yellowhead catfish posted this in #help-forum
Yellowhead catfishOP
when trying to send a request (I make a request with vanilla JS) to my Next JS application (I only need the status code of the request) it gives an error about the request being blocked by CORS. How can I fix this? My next application uses Clerk, maybe it is somehow interfering
const response = await fetch(MyUrl, {
method: 'GET',
});
3 Replies
Yellowhead catfishOP
Of course it's possible to put
mode: 'no-cors'
, but then I can't get the status code prompt, which I really needwhen beeing on localhost there won't be any origin headers sent with your request. When deploy there will be origin headers.
How to still have origin headers while beeing on localhost?
Use an extension like: https://chromewebstore.google.com/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf
This will add the origin header inside your localhost env
How to still have origin headers while beeing on localhost?
Use an extension like: https://chromewebstore.google.com/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf
This will add the origin header inside your localhost env
@Yellowhead catfish solved?