Site-webmanifest.json not being cached. (always MISS)

Hello everyone! I hope you’re all having a pleasant Monday! Although I’ve been a Cloudflare user since 2011, I haven’t been very active in these forums, so I apologize in advance if I’m posting this in the wrong area or otherwise. Let me know, and I’ll correct any issues with this post.

The issue I’m experiencing is probably due to some config issue on my end. However, I require your help… I appreciate your patience.

Answer these questions to help the Community help you get started.

What is the domain name? https://haydenjames.io/

Have you searched for an answer?
Yes. and also the web.

Please share your search results url:

When you tested your domain using the Cloudflare Diagnostic Center, what were the results?
I did search/find text on that page for that tool I’m honestly not sure where to find it.

I’ve been using browser inspect and curl as well to test:
image

Describe the issue you are having:
The following file won’t cache and is always marked “MISS”: https://haydenjames.io/site-webmanifest.json

What error message or number are you receiving?
N/A

What steps have you taken to resolve the issue?

  1. Confirmed headers and mime type config in Nginx
  2. disabled all caching plugins on Wordpress
  3. purged Cloudflare cache

Was the site working with SSL prior to adding it to Cloudflare?
Yes

What are the steps to reproduce the error:
N/A

Have you tried from another browser and/or incognito mode?
Yes, and yes. (Chrome and Firefox)

Hi,

APO will only cache HTML content. You can create a Cache Rule to cache your JSON file.

However, as I reloaded a few times the link to your file, I’ve seen the cf-apo-via: header :returned with different values:

cf-apo-via: origin,no-cache >> the origin sends a response Cache-Control header with a no-cache or similar directive.

cf-apo-via: origin,resnok, >> the HTTP Status was not 200. (Instead, it was 304)

So you may want to check your origin for configurations that might result in these intermittent results.

For more detail on the APO headers returned, please see: https://community.centminmod.com/threads/cloudflare-wordpress-plugin-automatic-platform-optimization.20486/

Hi @cbrandt, Thanks for the help.

I was not depending on APO to cache this file. Is this specific to JSON? Because css, js, and images are marked “HIT”. I was unaware that APO would influence the caching outside of HTML?

Sure, let me know if there are any config issues I need to look for on origin/Nginx. I have checked and .json is set the same as .js (as it relates to cache control and making sure the mime type is present). Anything else?

There’s a list of file extensions that Cloudflare considers “static files” and those are cached by default. Anything outside of this list needs a Cloudflare Rule (Page Rule or the newer Cache Rule (beta)) or some other product like APO.

Your origin is actually returning a cacheable Cache-Control directive, so I don’t know where APO gets the “no-cache” from.

Anyway, what you need to do is try a Cache Rule setting both browser and Edge cache to whatever time you with, see if that solves the problem.

Ok, I understand now what you are saying now. Thank you. Will check.

Also, I noticed a cookie is added to that file from a popular plugin. I am checking as well.

I will try this. thanks

Edit:
I was looking at the existing page rules:
image

Shouldn’t that rule apply to that file, also? Should I remove these since APO is being used?

1 Like

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