Transform Rules - Response Header New Action "Add"

Hi Everyone,

I am excited to announce that Cloudflare Transform Rules now allow you to “Add” a HTTP Response Header that does not remove/overwrite existing matching Response Header values.

A common use case for this is to set-cookie headers. Within Transform Rules, customers using the ‘Set’ operations and the Header Name ‘set-cookie’ would remove any cookies being applied from the Origin or Cloudflare features. Returning only those set within the Transform Rules rule to the end user.

Today, you can now simply select the Add option when configuring a Response Header in the Cloudflare dashboard (or using the API). This will allow you to add a Static defined response header without overwriting any existing values.

For example:

You can now see all existing set-cookie headers from the Origin and Cloudflare are left intact with the addition of the Added Transform Rules cookie.

Thanks,

Matt

4 Likes

Are we not able to add multiple Set-Cookie headers, it leads to a Header names must be unique error.

Edit: Also feeling a need for “Add Static” and “Add Dynamic”, we could have used Worker Routes, but we cannot match specific URLs with URL params in a Worker route.

1 Like

Are we not able to add multiple Set-Cookie headers, it leads to a Header names must be unique error.

You can add multiple Set-Cookie headers by creating multiple separate Response Header Modification Rules with action “Add”.

Edit: Also feeling a need for “Add Static” and “Add Dynamic”, we could have used Worker Routes, but we cannot match specific URLs with URL params in a Worker route.

I submitted a feature request for this.

1 Like

Thanks for this feedback - I will add to my list. I do want to make the whole cookie setting (request and response) a lot easier in the future.

Matt

1 Like