Internal only headers

Is it possible to add headers to a response which will only be present in workers/snippets that interact with that response within cloudflare. Trying to pass a version from a worker to a snippet without risking revealing that to clients.
3 Replies
Walshy
Walshy6mo ago
Best you can do is add it as a header and then remove in the snippet If this was Worker -> Worker you could pass it in req.cf over service bindings
Pingu
PinguOP6mo ago
Gotcha, makes sense. Do you know if there’s any way to persist variables / stores between snippet runs. Hard to find info cos everything is related to fetch caching
Walshy
Walshy6mo ago
you can put it in the global scope, if the isolate is re-used you'll still have those available or you can put it in cache api - https://developers.cloudflare.com/workers/runtime-apis/cache/ which puts it in the colo cache

Did you find this page helpful?