Accessing websites behind Cloudlfare via socket in C


#1

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.


#2

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


#3

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?


#4

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.


#5

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.


#6

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.


#7

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