Software Engineering · Global
Cloudflare Rules can now read response cookies by name
The new parsed fields distinguish original and current response cookies. A small staging check can tell you which one your edge rule actually needs.
By Launchr Space ·
Say an application sets an experiment cookie on signup, and the edge needs to attach a harmless diagnostic header whenever that response goes out. Searching the entire Set-Cookie header for a piece of text mixes together cookie names, values and attributes. Cloudflare’s November 27 update gives Rules expressions a way to refer to a response cookie by its name instead.
Original and current are different inputs
Cloudflare exposes two parsed fields. One reads the response headers as they currently stand; the other preserves the original headers. The current field can reflect changes from earlier rules phases, but that does not mean it sees earlier actions within the same phase. The difference matters if the input to one rule is supposed to come from an upstream service rather than from an edge change.
Both fields return arrays of values for URL-decoded cookie names. If a response sets a name twice, both values are kept. The fields do not include attributes such as Path and HttpOnly. That means a name match gives you a cleaner predicate, but it is not a way to audit cookie flags or determine which same-name cookie a browser would send on its next request.
Make staging prove the distinction
Start with a test cookie carrying a synthetic value and a rule that adds a diagnostic header only on approved staging routes. Exercise four responses: no cookie, one matching cookie, one nonmatching cookie, and two cookies that share a name. If an earlier phase can rewrite the headers, add a case where the raw and current fields are expected to differ. Check the behavior instead of assuming the position of a duplicate value answers the business question.
Keep authentication and authorization out of this test. A response cookie predicate can tell an edge rule what the response is setting; it is not proof of a user’s identity. With those limits clear, a parsed field is easier to explain and test than a broad header substring match.