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:
- 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.
- 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:
- Is there an advantage to setting up a reverse proxy via Workers, or is the advantage with transform rules.
- Is there any proximate difference between the two options?
- 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!