After reading yesterday’s blog post about Transform Rules, I have two questions in my head:
Is there anything I can do with a Transform Rule that I cannot do with a Worker? I get it that a Worker is overkill for some simple use-cases (“like wearing a diving suit in a kiddie pool” to quote from the blog post) but I already use Workers quite a lot. Is there any reason I should use Transform Rules in addition to Workers?
Will Transform Rules replace Page Rules at some point? They seem to do very similar things, but maybe I’m missing something…
I doubt it.
They are doing different things. Page Rules change the configuration of your account. Transform Rules change the HTTP request. Hopefully the capability of Page Rules will be increased to match that of Transform Rules, especially in the logic available to target requests.
Targeting with Workers is a blunt instrument, with Transform rules you have a much larger set of available conditions. Say you want to serve a different homepage for users in a certain country. With Transform Rules that is relatively simple, just append a parameter to the URL for users in the target country. With workers you have to put that logic into a worker, and pay for every request even if they are not relevant to your logic.
Thanks, @michael! As mentioned, I already use Workers, and I know it’s probably overkill for a lot of tasks (like country targeting) that can be done smoother with a Transform Rule.
But my question is still if there’s anything a Transform Rule can do that a worker cannot.
By design, Transform rules run before all other CF products including Workers. So if you want to do a static/dynamic URL rewrite or request header modification sent to your origin before it hits Workers.
My only use case right now is I have CF Worker doing guest full HTML page caching with cookie bypass. For layer 7 app attacks which use random query strings to attempt to bypass CF CDN cache, I set up a CF Transform rule to normalise the bad query strings so they end up being ignored and serve the CF CDN cached response on the first request rather than on the second request in my CF Worker based caching. So when /page?randomquerystring is requested, serve /page cached HTML response.
One limitation of Transform Rules vs CF Workers is that I use Enterprise Bot Management and the bot management score criteria is only available in CF Workers or CF Firewalls. CF Transform Rules doesn’t have a criteria for Bot Management scores and understandably so as CF Transform rules are processed before they hit any CF products.
Thanks, @eva2000, interesting use case, I’ll keep that in mind!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.