Cloudlflare API - Chrome Extension Preflight Issue


#1

Hey there,

I am quite desperate in trying to get the Cloudflare API running properly. I generated my API Key, tested out one of the requests like “https://api.cloudflare.com/client/v4/zones” (GET request) in the shell and it worked. Now I wanted to write a quick Chrome Extension to handle the caching modes. Also, I have to send two headers “X-Auth-Email” and “X-Auth-Key” to the Cloudflare API on every request to authenticate myself.

The problem is that, as soon as I add a “non-standard” header like the authentication ones, Chrome performs a preflight check. Chrome calls the URL as an OPTIONS request to see if all stuff here is valid. But of course the Cloudflare API doesn’t accept OPTIONS requests, so it always fails. Is there any way around it?

Thanks in advance …