I want to use CloudFlare as a CDN to cache and serve a static file in order to reduce the load on my server, however, the catch is that I only want this file to be served to paid users since it's an application.

Is there a way to serve a static file that's cached through CloudFlare's service (preferably in the free tier, although, higher tiers are an option) so that only paid users can access it? Is there a parameter setting in PageRules or something else I might be able to use for this?


I would rather not simply place it behind a URL with a key in it (i.e., http://static.example.com/NSRP7SVYTR/myfile) because users can then simply link to this and share it whenever it changes.

  • If I follow you correctly, you want to have CloudFlare to cache large application files to reduce the load on your server, but to serve them only to paid users. In order for CloudFlare to be able to cache files from your origin server, the URIs need to be accessible so they can be distributed among their servers. I do not think there is a way to separate proxy requests for the same URI into paid versus not paid using unique key parameters. If I understood this correctly though, I think the question could be clarified & simplified, which I can help with, and then reopened. – dan Oct 6 '16 at 5:12
  • @dan you understand correctly. I was thinking about something along the lines of cloud flare sending back the users parameters to my origin then getting a yes/no in response of whether to send. Feel free to propose edits (I honestly don't know how to make my question more clear, although I do acknowledge that it is possible). – john01dav Oct 6 '16 at 5:23
  • I clarified it, and removed the bullet points that were either redundant or asking for alternatives (note we don't permit recommendations here). In regards to the yes/no response based on parameters, you can ignore query strings in URLs within PageRules, but you'd still need to have the file accessible so that CloudFlare can cache it, and therein lies your dilemma... Maybe @damoncloudflare or someone from CloudFlare might drop in and answer this (now that it's clearer). – dan Oct 6 '16 at 6:04

That may be possible using custom WAF, but that type of customization is currently only available for Enterprise customers. You may want to talk to Sales and see what they can offer.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.