Need Help With Page Rules

Can someone guide me on to exclude mp3 files from being cached with the help of pagge rules.

I want to cache all the static files at the same time want to exclude mp3 files.

I use wordpress and here’s permalink sample in case if it helps:

There’s not much reason to exclude .mp3 from cache, as they’re unlikely to change. Maybe that’s not so in your case. But here’s the rule:

1 Like

Hey there thank you for the help, the only reason i don’t want to cache mp3 is i have huge collection of mp3’s and i dont want cloudlare to suspend my account as i want to stay on free plan due to budget constrain.

Just out of curosity as said above all my mp3 files have Urls something like this:

So the rule you mentioned would work for all audio files irrespective of audio location ?

You’d still be in violation of Terms of Service. Cached or not, those files are still going through Cloudflare.


Understandable but i am excluding audio files right which are not being cached and they are directly served from Origin hosting. I only want to cache basic static files like html, css, javascript and some pictures.

How are you serving them directly from origin hosting? Are they on a separate hostname that’s set to :grey: DNS Only? In that case, you don’t need a Page Rule for those.

1 Like

Sorry for my knowledge but all connections are proxied through Cloudflare. I choose standard cache as of now + That page rule you mentioned. Meaning the audio files are being seved from origin right ?

Nope. They’re served through Cloudflare, and violate ToS. This is a familiar issue.

Can you please guide on how to avoid that on free plan?

Put your MP3 files on a subdomain that’s set to :grey: DNS Only.

Cool thanks for the idea.
When i change dns settings from proxied to dns only it throws this pop up saying this record exposes the ip behind Cloudflare. Is that fine ?

I think you just deleted the screenshot, but it probably says something like “This record exposes the IP address of a proxied hostname.” That’s normal in this situation and unavoidable. It’d be nicer to not expose that IP address so attackers don’t know what IP address to attack directly, but I don’t think you’ll have a choice and will most likely not suffer an attack due to that.

Now my client site has already setup and all audio files are in place and changing file location to sub domain would be a ■■■■ lot of mess. Is there any alternate please think that would be huge help!!!

I’m afraid there’s no workaround if those files are on a hostname that’s :orange: Proxied.

1 Like

Make the files available through a :grey: hostname. Then create a Page Rule or Bulk Redirect to send mp3 requests from the “main” hostname to the :grey: hostname. Users will take a slight performance hit on the redirect, but its not a big deal.

1 Like

One last doubt.
What would be peak point of bandwidth limit on free plan. I know in general its free forever with limited static files but in my client case audio files are being cached too and served around 2-3tb bandwidth per month. and most of his competitors are serving more than that. What would be your guess on maximum limit allowed on free plan. I know its hard to answer which we dont know that but gimme some safe spot number.

That’s like asking how much over the speed limit is safe for not getting a ticket. The wording in ToS is a “disproportionate amount” of traffic. mp3s are pretty heavy, so your stats are going to reflect that.

@michael’s workaround is a good option if you’re able to manage this:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.