CloudFlare not caching - what am I missing?

Hi,

New to CloudFlare, so, I (know I) might be doing something wrong.

I have an API serving json via an IP address - no domain/sub-domain setup (yet). It is also serving on the 2095 port.

This is an example of the request: http://{IP Address}:2095/api/something/?query=john&limit=3&fmt=json

The response is plain json.

I have added an A Type DNS entry to CloudFlare with a name of search and Content with the IP address of the API server above. This is being proxied.

When I hit http://search.{domain name}.com:2095/api/something/?query=john&limit=3&fmt=json I get the exact same response as when I hit it via http://{IP Address}:2095/api/something/?query=john&limit=3&fmt=json

The same happens if I switch “Proxied” to “DNS Only” in CloudFlare.

As this was working in terms of content I thought I had it all in place but when I go to the Analytics page on CloudFlare I can see no Cached Requests were served - only Uncached.

I presume this means CloudFlare is not caching (and so, not serving cached) content.

I added Page Rules for search.{domain name}.com:2095/api/?*fmt=json with a few settings combinations but now with the following:
Browser Cache TTL - 30 minutes
Cache Level - Cache Everything
Edge Cache TTL - 2 hours

What am I missing?

Thank you in advance to anyone spending time to help.

That’s all what I would have tried. Though I’m not so sure about putting a query string followed by a wildcard. I suggest you try ending with /api/* just to see if anything works as a test.

What does cf-cache-status show in the response header?

@sdayman Thank you for taking the time to help.

I have removed the querystring now. Unfortunately, I get the same result.

CF-Cache-Status: DYNAMIC

Now I’m really grasping at straws. I know Port # can be part of the page rule, but if it’s omitted, it should match all ports.

  1. My strategy is to widen the net until you finally get a Match.
  2. Is this rule at the top of your Page Rules? Hopefully nothing else matches earlier, which would stop page rule parsing.

I only have one Page Rule - this one.

Good suggestion - I will try and remove port and widen it.

Thanks again for your help!

Still no joy with only *search.{domain name}.com *

Thanks for your help.

Please let me know if you think of anything else.

This topic was automatically closed after 31 days. New replies are no longer allowed.