I am getting the CORS policy: No ‘Access-Control-Allow-Origin’ error when I deploy my app with Firebase but it is working fine when run locally.
I am prefixing my API calls with https://thingproxy.freeboard.io/fetch as a CORS anywhere type-approach for the sake of simplicity. My understanding was that this should work no matter what the origin of the request is (localhost or a live deployed site) but perhaps I have misunderstood.
I know this is commonly asked question but I can’t see what I’m doing wrong, so any help would be greatly appreciated!
Also apologies if I haven’t provided enough info, this is my first post here.
I have edited your post to also include the github link.
I am not as far long as you so I wouldn’t be able to assist you .
But there are plenty of people on the forum with the expertise that would be happy to help.
Also, keep in mind that sundays are sometimes slow on the forum.
So if it takes a while for someone to respond then that is normal.
Others might have a nicer solution, but the only way I have ever avoided this error is by using cors in a backend API. That is, you will need to create a backend, and fetch the data from there, to pass to your frontend.
This way, you have more control over the headers in the request.
Sadly it didn’t work but in my head this should mean that any requests sent to https://jobstasy.web.app would be forwarded to https://jobs.github.com. So in theory https://jobstasy.web.app/positions.json?description=react&location=london for example would be forwarded to https://jobs.github.com/positions.json?description=react&location=london and so would be same origin, but no luck unfortunately.
I will have a bit more of a look into setting up a back-end for this.