Prepend prefix to origin request

I have a files subdomain that is currently a CNAME directed to my Backblaze B2. Files on B2 are accessible from https://f001.backblazeb2.com/file/MY_BUCKET/FILE_NAME.jpg. I would like to route these files through Cloudflare and access them from https://files.example.com/FILE_NAME.jpg. I followed this article but its process requires always accessing it from https://files.example.com/file/MY_BUCKET/FILE_NAME.jpg, which means every request has /file/MY_BUCKET included, which I do not want. Is there any way, using Cloudflare’s free plan, to serve requests by prepending the /file/MY_BUCKET part of the URL to the CDN’s request to my B2 origin? I have all three page rules available if they are needed.

You could use Cloudflare workers, which is a paid feature. I don’t believe there is otherwise any way to rewrite on the fly in this particular situation.

2 Likes

I wrote a feature request: Page Rule setting: "Request Rewrite"

If you’re stumbling upon this and hoping for the same feature, go there and give it a :heart:.

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