Accessing websites behind Cloudlfare via socket in C

What I have: I’ve written a primitive HTTP(S) wrapper for sockets in C. TLS, Header and post data are already wrapped in it.

What I did: I already fetched data from various sites via this library successfully but as soon as I am encountering a website behind Cloudflare I can’t access it and get a 403 from Cloudflare. I also fiddled with the cfuid_cookie and other header values.

What I wanna know: Do I have to set specific header parameters to get behind the Cloudflare proxy and access the actual web content? I am really out of ideas how to access data behind a Cloudflare proxy.

No, thats the whole point of Cloudflare’s protection layer.

Well how do Firefox, Chrome etc access the content of a webserver behind Cloudflare? Is there any javascript code getting executed in the background? Is there a whitepaper to read how the whole Cloudflare system works?

Precisely. It might depend on the exact code you get but e.g. the challenges are designed to only let through genuine users and their browsers.

Well so far I am constantly getting a 403 error. I just wanna access some rest APIs that lie behind the Cloudflare protection layer. I mean not gonna lie puttin a rest API behind Cloudflare screams for problems already. I’d greatly appreciate some subtle hints towards the right direction for my code if that’s you are allowed to do that.

Not necessarily, it depends on how the site, respectively its Cloudflare settings, is configured.

If it is a public interface, supposed to be queried, I’d really contact the site owner and make him aware of the issue. In that case he should be able to tweak the settings in order for the interface be available without problems.

Thank you very much for the advice. I’ve already reverse engineered some browser code which should make my work a bit easier. If I’ll encounter any problems I’ll let you guys know.

Have a great day