How can I change the cache key?

Hi, the cache key is described as,

A Cache Level of Ignore Query String creates the following Cache Key: ${header:origin}::${scheme}://${host_header}${uri_iqs}

I’d like to remove the origin header from my key. The docs for creating custom cache keys suggest that page rules can set Custom Cache Key, however I do not have this option. Has it moved?

cache-cf

You need an Enterprise plan for that feature.

https://developers.cloudflare.com/workers/examples/cache-using-fetch#custom-cache-keys

3 Likes

Thanks for your reply! I guess I’ll just make it be uniform then.

You can remove the Origin header using a Transform Rule.

https://developers.cloudflare.com/rules/transform/request-header-modification/examples#remove-an-http-request-header

The transform runs before the Cache, so has the same effect as a custom cache key.

2 Likes

Ooooh sweet. I may use this instead, thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.