I’ve got a service that writes the following header:
Cache-Control: max-age=604800
On the login page (https://rapidhtml.app/login). However, I cannot see the header in my developer tools, nor can I see any caching behaviour.
here’s the dns setup:
CNAME rapidhtml app → rapidhtml-1 onrender com
CNAME www → rapidhtml-1 onrender com
The setup is a simple go service in a docker container. I added a 1s delay for the login page to test whether the page would be cached, but for some reason no matter what I try, I cannot see the cache-control header.
Any idea how can I implement caching with render using cloudfare?
This is because all traffic goes through Render’s Cloudflare zone which isn’t cached. To work around this you can implement caching in your Cloudflare zone with a worker which uses the Cache API, you can find an example here: https://developers.cloudflare.com/workers/examples/cache-api/.