Written cache control header is missing on response

Hello

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?

HI there,

Looks set to me:

$ curl -sS -D - https://rapidhtml.app/login -o /dev/nullHTTP/2 200date: Tue, 07 May 2024 06:20:11 GMTcontent-type: text/html; charset=utf-8cf-cache-status: DYNAMICcache-control: max-age=604800vary: Accept-Encodingrndr-id: a1322bf8-ad99-4fe0x-render-origin-server: Renderreport-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=jTSmKMssbmzaRk7nWdkVfnKytsTDFbH%2B66gPtYEADepTcu4cWMo37S%2FvlgTTbRJjdKlqqq0KANPaptM1Ud%2BhQ18WlSaUdoCcPeqCbcRwY%2BUUjrH4Vgomvj%2BTf%2FfZhs67"}],"group":"cf-nel","max_age":604800}nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}server: cloudflarecf-ray: 87ff1a46bc9329ba-MELalt-svc: h3=":443"; ma=86400

Regards,

Keith
Render Support, UTC+10 :australia:

It’s set, but I still get DYNAMIC. I think this might be an issue from cloudfare itself, I’m trying to cache dynamic content.

Hi there,

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/.

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.