Forced downloads

Since I can no longer set MIME types in cPanel - I have issues with forced downloading on mobile. I run a podcast and am currently using AddType audio/mpeg .mp3 in my htaccess file for browsers to recognize the files.

Direct downloads work as they should on Desktop but not on mobile. I’ve tried PHP options that are all over Stackoverflow and elsewhere to no avail.

The actual podcast URLs are hosted on Podbean outside of my domain.

Is there anyway to set a rule in Cloudfare to force downloads as opposed to loading the default Wordpress player with three vertical dots you have to click to download?

Just thought I’d ask.

You can force a download with the content type ’application/octet-stream", but since the actual mp3 audio file is on another server, you might not be able to force this content-type since it needs to be on the actual URL it’s downloaded from.

But no, this isn’t a feature CF has that is built-in.

I thought the correct way to force a download was with a Content-Disposition response header:
Content-Disposition: attachment

1 Like

I remember octet-stream being the way in the past, but that definitely sounds better.

It’s actually content-type and content-disposition but type in my case is audio/mpeg .mp3 Not sure why it works on desktop but not on mobile.

However, you’re right about the URLs being from a different domain. I can’t control the behavior because they are hosted elsewhere as opposed to a bucket on AWS then it would work.

Anyway, Podbean sent me a workaround to change a word in the URL, which I was able to do in bulk using the Find and Replace All plugin for Wordpress. After clearing my cache it worked like a charm!

Thanks for the response.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.