DEV Community

loading...

Having Problems CORS with the Dev.to API

jrsofty profile image Jason Reed ・1 min read

I'm trying to use the DEV.to API via a request from my personal webpage using JavaScript, and the browser is constantly blocking the request. I believe the problem is that with the CORS security that the certificate is not considered valid by the browser. This is specifically because the certificate is not issued to "dev.to" but to the actual server under the "fastly.net" domain. Will this continue, or will there be an eventual valid certificate for the "dev.to" domain to allow use without CORS violations in a browser?

Discussion (6)

pic
Editor guide
Collapse
ben profile image
Ben Halpern

Will this continue, or will there be an eventual valid certificate for the "dev.to" domain to allow use without CORS violations in a browser?

I believe our intention is to fix this, but honestly we haven't had the time to look at it. Speaking without pure certainty, yes, we intend to fix this CORS issue.

If anyone can dump some helpful info on how we might want to approach this general problem, feel free to leave it here.

Collapse
karaluton profile image
Kara Luton

I'm having this issue as well

Collapse
jrsofty profile image
Jason Reed Author

I solved this issue by using a little PHP script uses curl to call the dev.to api, and delivers it to my frontend.

Collapse
karaluton profile image
Kara Luton

Could you post the script?

Thread Thread
jrsofty profile image
Collapse
rhymes profile image
rhymes

Hi @jrsofty , we recently updated the API to be able to serve content behind CORS restrictions, let me know if that works for you :)

Thanks for your patience!