Using Cache API Put and Match in same worker request

Here’s the playground version:
https://workers.cloudflare.com/playground#LYVwNgLglgDghgJwgegGYHsHALQBM4RwDcABAEbogB2+CAngLzbPYDqApmQNJQQBimYACFKNRHQBu7KgC8AbAGcAglwCsAcwAKXABwApCWABcLFh268BWEdVqTp85Wq26DYALAAoAMLoqEaQhsABEoBRh0BV4oPyMSDCw8AmISKjhgdgYAInxCADoAKwUs0lQoMGl0zJzkwuKvX39A7AAVOhh2OLgYGDAoAGMCGKpkArgJOAV+hFgIAGpgdFxwdi8vdgAPCKQSXHZUOHAIEgBvTwBINIy4rIBRDfTe9hIlTQBJLIAaC8J1BTiANpZTaPCpfEhZbpQcFZBDscJ+BTsLIAXW+AF8iJ4vKZmOYePxBDYxPQpLJFCoNNp9IYGn4Av4QmEIlFoLF4oIkoRSFdqlAaJs6iV4uVKhlsvy9hshXSmoy2h0uj0+oM2SMxhMpjMYPNFssKmtPFBgNtjgB3dhgfroDLxBA2iEWq029h5AAWEGAYBKnk8yAAVP7PCR-SQAAIQdrsPaoU4AeTIBXY-Qg6JItyoEmD-uQvs2pt2+0OkFOFwDQfOIfD8AQ6VOACV2ABHEDw1MkOEttsXKthmt1k4ZiRp6RZyuhvuIAf3ZMgNWNAIbdspjY9idwiAgBBUBSnTT24BhdgAHkbCJ37AAfOi17nzpM6FR+vF2BB+m6ABSd1sKCCfEijv+K4AJSluc5wTAgJCDO+zwMNBcCwQoeQxsWEAXOc1o7scMFuuwACqMwkPBADkHoQDA-zIMgAS-iRGFwGacC8AhsF5DAc4frhBEzP+VDsGaJBnhEF4fiRLRtiRwHAb64GMcxxz8YJ+42keX7wugYBSMRl4kEiEAtMa7CUBA6kKJpUj-gAjAADHZ0kYVhv4kMABDvsRJDySx3F5K5b6ftxhFQDJ4EYVAsYfn57kMDFJC2Ps-LRqBZzgZhiKaa6YDoOoYkAHLoCQACyblugAhFJGHnBuW5UKkAlCfCIlInlBXFf55UhecI5gEiYHgdV24uSVGE3hc6IYliOK4vilhEq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Rjyji7jwh-dMW9jhTJIPAY2nkKDaSOcgKEvDQmsqhugQSAqQQmgqJHLFpMaAlK3m0uOgQOwmXhBSql6yaWeR6gVel6FQkCt2YcgqMqpEEEGSyKI4tOFnLIDMVZZS6pLniXsFmRy+ioFdH8gBrl+RY3TmvDecMF6XVhlNUwM1CTWHmuIRaFJnDUjcC9TazJIjRHZPtLkR11ZZGZodYUZQKi3XFugMgz11pyjelGJUvQBhDD8KMcyf1sSeBOGW36AB9PUKwshGCyJKQURQsjogTWYTgBIrDCFTaSBwGaqSuEMMwLwQA

This works just fine in wrangler dev, but not in production. Am I not able to fetch a cache match after issuing a put?

Hi there!

Your code is working for me, did you deploy it on a Custom Domain or Route? You won’t be able to use cache API on workers.dev default URLs: