An online shop can serve catalogue pages, checkout and an API from the same website address. A catalogue page can often be saved and reused for several visitors. A checkout depends on the shopper’s cart. You can give each part of the site its own rule, so a performance change on the catalogue leaves checkout behaviour alone.
In 2022, we added Wirefilter, the language Peakhour uses to describe which requests a rule applies to. You choose a condition and the action to take when it matches. This condition matches page or file requests made with GET under /catalogue/:
starts_with(http.request.uri.path, "/catalogue/") and http.request.method == "GET"
Use a condition like this to set caching for the catalogue. You can use the same language to give sign-in its own request limit or apply a security check to an API. If several rules rely on the same set of values, put those values in a shared list so a single edit updates every rule that refers to it. Rules engine guide
We added expression validation to the dashboard and API so mistakes can be caught when you save a rule. The edge evaluates the filter during the phase you choose. Request fields are available early. A condition that needs the origin’s HTTP status has to run in a response phase, after the status is available. The Wirefilter language reference shows the fields and operators you can use.
See the Peakhour release history for how the rules engine developed.