shiichan

Compare Dynamic Values on Both Sides in Rules Expressions

Hi, Shii-chan here! Rules expressions just got a lot more flexible!

Cloudflare Changelog developers.cloudflare.com

What was announced?

The Cloudflare Changelog announced that Rules expressions now support dynamic values on both sides of equality and ordering comparisons.

The story so far

Comparisons used to be between a field and a fixed value.

What changes

You can compare request fields or function results with one another. A condition like "has the path changed from its original value?" now fits in a single expression!

Dive Deep

Here is the example from the post:

http.request.uri.path ne raw.http.request.uri.path

It compares the current request path with its original value. For supported operators and examples, see the Compare dynamic values page linked in the post.

Wrap-up

  • Dynamic values work on both sides of equality and ordering comparisons
  • Fields and function results can be compared with each other

Handy when you want to compare a request before and after a rewrite!