Protecting public JSON API responses from scraping when using Cloudflare CDN — is there any real solution?
retained text
<!-- SC_OFF --><div class="md"><p>Hi,</p> <p>I have a web app that serves cached JSON files via Cloudflare CDN. The data is generated by a proprietary algorithm and has significant competitive value.</p> <p>The JSON structure is simple to discover:</p> <ul> <li><code>/cache/_index.json</code> → lists manifest URLs</li> <li><code>/cache/manifest_xxx.json</code> → lists data file URLs</li> <li><code>/cache/data_xxx.json</code> → actual proprietary data</li> </ul> <p>Anyone can write a 20-line script to crawl the full dataset in minutes. Rate limiting (Nginx, 60 req/min) slows it down but doesn't stop a patient scraper.</p> <p>The obvious solution would be JWT token authentication on the JSON endpoints, but Cloudflare CDN caches by URL — adding auth headers breaks caching entirely, defeating the purpose of having a CDN.</p> <p>Constraints:</p> <ul> <li>Must keep Cloudflare CDN caching working (performance critical)</li> <li>No user login/registration exists — it's a fully public site</li> <li>Data must remain accessible to legitimate browser users</li> <li>Cannot move away from Cloudflare</li> </ul> <p>Is there any real, production-proven solution to this problem? Or is "public CDN-cached data" fundamentally incompatible with "access control"?</p> <p>What would you do?</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/JosetxoXbox"> /u/JosetxoXbox </a> <br /> <span><a href="https://www.reddit.com/r/webdev/comments/1tv1dwj/protecting_public_json_api_responses_from/">[link]</a></span>   <span><a href="https://www.reddit.com/r/webdev/comments/1tv1dwj/protecting_public_json_api_responses_from/">[comments]</a></span>
document fetched 2026-06-03 10:48