compute@edge: Manipulating the cache key in Rust
I have just spent the last few hours porting our VCL service to into Rust code for a new WASM Fastly service. Literally the few lines of the VCL I need to port involve manipulating the cache key, which is a crucial part of our edge logic, but I can't find any API docs or reference to this being possible (d'oh!). In VCL we're doing something like this: https://docs.fastly.com/en/guides/manipulating-the-cache-key
In the docs here: https://developer.fastly.com/learning/compute/rust/#communicating-with-backend-servers-and-the-fastly-cache, we can see reference to `fastly::request::CacheOverride`, but only a single reference, despite what the text itself states. I assume this has been refactored in the 0.6 crate, and also assume it was just the `set_ttl` stuff anyway.
The question is, can I still set the cache key somehow? Would it be enough to manipulate the backend response to add a `Vary` header? I suspect not, because I want to set a different `Vary` header again in the response we send to clients.
Maybe it would be enough to set the `Vary` header on the backend request? That would be kind of random, but more in line with the `set_ttl` method which is also on the Request rather than on the backend's response.
It would be such a shame to have gotten this far and not be able to switch over to the new service because of this minor detail. I would be very happy to hear from anyone with experience on this, thanks in advance!
Please sign in to leave a comment.
Comments
0 comments