Page rule and new url disclosure in browser

Hi All,

I’m doing integration with Backblaze. They provide simple solution: create a CNAME and enable Full SSL.

Files available via url “https://my_cname/file/bucket_name/path”

I want user to use shorter “https://my_cname/path”. Page Rule that redirect https://my_cname/* to https://my_cname/file/bucket_name/$1 works perfectly, but actually disclose full path in address bar.

Are there any way to hide B2 part from users?

To rewrite the request would require the use of Workers if you wanted to do it on Cloudflare’s edge. Something like https://developers.cloudflare.com/workers/archive/recipes/vcl-conversion/conditionally-changing-a-url/ but changing pathname 1 to pathname 2 for the request to origin.

Changing pathname did not solve a problem.

  1. Worker with
    let url = new URL(request.url);
    return fetch(‘https://my_cname/file/bucket_name’ + url.pathname)
  2. Route
    my_cname/path - Worker

Did the trick.
Thank you for your help.