http_header for webmanifest.php set to cache:private

Marcus

Well-known member
Current header for webmanifest.php is cache-control: private, max-age=86400, I suggest to set it to public. Much easier when using CDNs.
 
It would allow CDN's to cache it on the edge in their data centers. You can see Cloudflare's default cache behavior broken down here:


However, in Cloudflare's case even with a public Cache-Control header, it still wouldn't be cached by Cloudflare because they also base default behavior on file extension (NOT mime type). You can work around the file extension thing and explicitly instruct Cloudflare to cache it with a Page Rule (as an example, I tell Cloudflare that css.php is cacheable content):

1664986217724.webp

So with Cloudflare you would need to use a Page Rule regardless because of the .php file extension, at which point you can also override the Cache-Control header with the same Page Rule. So with Cloudflare it doesn't do or save much (still would need a Page Rule to override).

However, other CDNs may base caching on mime type, rather than file extension, so for those CDNs, it could be advantageous (assuming webmanifest.php is the same for all users). If the Cache-Control is set to public, I'd recommend the manifest URL to be unique for each theme (like s=1 or something). Because if you cache the manifest URL, all users would get the same version and it looks to me like there are parts that are style-specific, rather than site-specific. That's why css.php is cacheable, because the URL is unique to the style.
 
Exactly. The new CDNs can achieve that very easy, but you have to make a "cache webmanifest disregarding its http-cache-header" record which is not needed if that file would return a public http header. I just disabled PWA for the moment as it's not in use anyway.

I got my forum on 100/100 mobile/desktop on pagespeed.web.dev so I guess there are other areas than speed where my communities will profit more.
 
Top Bottom