Reverse Proxy vs URL Rewrite (Transform Rules)

Hello! I was hoping that someone could help be understand the advantages to using a Reverse Proxy (via Workers) vs using Transform Rules to perform a URL rewrite.

We are in the process of moving the CMS at domain(dot)com to a new host, which is largely complete. The only thing remaining is updating the A & AAAA records in Cloudflare to point to a new host. The issue is that the CMS that is being migrated isn’t the only thing on the server accessible through domain(dot)com. Given a host of issues, the CMS is being migrated to a purpose built hosting platform, but the another application (currently accessible as a subdirectory: domain(dot)com / subdirectory) is remaining with the current host. The obvious challenge is that by updating the DNS records for domain(dot)com and www(dot)domain(dot)com, visitors to the site will no longer be able to access the application that currently lives at domain(dot)com / subdirectory.

Given this issue, we’ve created subdomain(dot)domain(dot)com so that the application is now accessible by navigating to subdomain(dot)domain(dot)com / subdirectory, and have the DNS configured for that to resolve correctly (i.e. DNS pointed at the current host for that application).

We are considering one of the two following options to move forward:

  1. Rewrite rule in Cloudflare: requests for domain(dot)com / subdirectory will return content from subdomain(dot)domain(dot)com / subdirectory while the URL will display as domain(dot)com / subdirectory.
  2. Setting up a reverse proxy in Cloudflare Workers: similar approach as in option 1.

Where I’m currently unclear is whether there is any advantage to one approach over the other. I’ve used “URL Masking” in the past, and that has had performance issues (not to mention other issues like CORS, etc). I was previously under the impression that Cloudflare’s transform rules used a similar approach but that doesn’t appear to be the case. It would seem to a casual observer the the transform rule is essentially acting as a reverse proxy.

If anyone would be so kind as to help me understand the following, I would be incredibly grateful:

  1. Is there an advantage to setting up a reverse proxy via Workers, or is the advantage with transform rules.
  2. Is there any proximate difference between the two options?
  3. Are there any issues that we should be mindful of in either approach (e.g. CORS/Content Security Policy, etc)?

I hate to ask, but I’ve not been able to find concrete information through my many Google searches.

Thanks in advance!

Not sure where you got to with this, and I’ve got similar questions, but here is what I can tell so far.

  1. URL rewrite transform rules can only rewrite the URL path or query params, not the domain. Similarly Cloudflare doesn’t seem to let you use a header transform rule to rewrite the Host header, so no luck there either. As far as I can tell from here https://developers.cloudflare.com/support/page-rules/using-page-rules-to-rewrite-host-headers/ you need an enterprise (!) plan to achieve this.
  2. Workers will allow you to achieve this or anything else, but ofcourse you then need to pay for Workers quota.

How did you end up doing it?