DEV Community

Jason Reed
Jason Reed

Posted on

Having Problems CORS with the Dev.to API

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?

Top comments (7)

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!

Collapse
 
jrsofty profile image
Jason Reed

Sorry it's been so long, but I finally got around to updating things and it works so much better now. Thanks.

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

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
Jason Reed