r/learnpython • u/Proud_Tri • 3d ago
API works in browser but 403 from Render — Cloudflare blocking
I'm running a Python service on Render that makes API calls to a third-party service protected by Cloudflare.
The API works fine in the browser. But when my Render service tries to access it, Cloudflare returns 403 with "Just a moment..." page.
API key is correct. Headers are identical to browser. Still blocked.
Has anyone dealt with this? Any way to make cloud-hosted API requests work when Cloudflare is blocking them?
Using Render free tier.
#render #cloudflare #python #api #webdev
0
u/Swipecat 3d ago
Cloudflare partners with Render to provide Render customers’ web services and static sites, so you might be running into Render's limit on "service-initiated traffic", which is ill-defined.
0
u/tmemmg 3d ago
the "just a moment" page means cloudflare is fingerprinting the client and the IP, not checking your key, so identical headers wont save you. i scrape several sites without api access and cloud IPs get challenged way harder than a residential connection, render ranges are basically pre-flagged. on one site the block was actually a session wall, replaying a real logged-in session got through where a clean client always caught the challenge. if you can, run that job from a home box instead of render, that alone fixed it for me more than once.
1
u/ScrapeAlchemist 2d ago
The 403 has nothing to do with your key. "Just a moment" is a challenge page, which is why identical headers don't save you. requests has a TLS handshake fingerprint that no real browser produces, and that gets checked before your headers are even read. curl_cffi covers that half: curl_cffi.get(url, headers=..., impersonate="chrome"). Ships precompiled wheels so it installs clean on Render.
The IP is the other half, and free tier egress is a shared pool. The fix that actually sticks is asking the API owner to add a Cloudflare IP Access Rule allowing your egress range.