I have configured a transform rule which sets a custom request header for my origin.
My origin generates an answer with a Vary: , but Cloudflare does not take it into account ( it accepts only accept-encoding and some other for images ).
Now I try to configure a custom cache rule with this custom-header.
I also left the “include origin header” ( no idea what this means, is it about response headers ? ) checked, but it does not seem to work, I receive cached-response with the wrong custom header.
What am I missing?
Cloudflare only supports Vary for Images, as you have discovered.
If you are an Enterprise customer you can configure a custom cache key.
The easiest thing is to append a query parameter in the request to your Origin, using essentially the same transform rule you are using to append the header. In this case, Vary is not really needed to shard the Cloudflare cache.
Origin
is a HTTP request header associated with CORS. It is part of the default cache key.
1 Like
The easiest thing is to append a query parameter in the request to your Origin, using essentially the same transform rule you are using to append the header. In this case, Vary is not really needed to shard the Cloudflare cache.
No this does not work. The custom header and the custom query string parameters can’t be applied a the same phase and cf.clientisbot is not available at the “http_request_transform” phase ( and it is available at the http_request_late_transform phase )