Javascript CORS Errors

Hello,

I’m trying to do a minor integration of my Write.As blog into my personal website and I can’t get any HTTP request to succeed due to CORS. I have an example up on JSFiddle, open up the developer console and hit ‘Run’ and you should see a bunch of CORS errors.

As far as I can tell it seems that Write.As isn’t filling out the CORS headers so the browser is rejecting them. I tried working around it by using the ‘no-cors’ mode but then the responses turn into opaque ones that don’t have any data in them.

Thank you for making the API, just need this little change and I’ll be good to go!

Hi @Dar13! Thanks for finding this.

In the meantime, you could use a proxy server. I set one up on Glitch using cors-anywhere, a reliable cors proxy library. All you do is prepend the proxy url to the request url. Check out a fork of your JSFiddle example with the proxy here. It should return a 200 response in the console. Feel free to use that proxy url on your website.

Hope that helps!

2 Likes

@cjeller1592, the private bubbler project you mentioned here has been suspended for Terms-of-Service violations, and the issue with Write.As and CORS is not resolved.

I’ll investigate using ‘cors-anywhere’ myself in the meantime.

Sorry about that happening @Dar13 — I think trying to host it yourself would probably be the best option at the moment. Remixing the base project in Glitch will probably come to the same conclusion.

But these are temporary solutions to the main problem which is the No 'Access-Control-Allow-Origin' header is present error. I’ll make a note about it to the team and see what we can do.