Multiple HTML‌ versions are cached for same URL but different user agents

Platform: Wordpress with Twenty Twenty theme
Active Subscription: Free Plan

Page Rule:
Maching URL: https://example.com/*

  • Cache Level: Cache Everything
  • Edge Cache TTL: 14 days

I am using an online HTTP Client (REQBIN) to send GET requests to the homepage (https://example.com/) and the response has no-js class in html tag (Wordpress thing):

<html class="no-js" lang="en-US">

But when I use Chrome Desktop to send same request to the same URL (https://example.com/) the response has js class in html tag:

<html class="js" lang="en-US">

And as I have CF-Cache-Status: HIT in both cases, it looks like Cloudflare is caching multiple versions for different user agents which in my case, is not the desired behaviour.

I removed the User-Agent from Vary header, using a worker and now I have response headers in both cases (online HTTP client and Chrome Desktop) like this:

CF-Cache-Status: HIT
Vary: Accept-Encoding

I need to serve EXACT SAME version of my html to all requests from any device type or any user agent, which seams to be impossible on Cloudflare!

Please help.

You are using Modernizr?

Moreover, does this tool have some User-agent and Javascript support enabled or disabled?
Could be due to the cookie?
Any Cache-Control headers?
Did the request went through the same IP to your website?

Also, you say you are using Cloudflare workers too, right?

You are using Modernizr?

I dont think so, and I don’t think if this is something really important.

does this tool have some User-agent and Javascript support enabled or disabled?

I don’t think so. These are all the options it has:

Could be due to the cookie?

I don’t know. How can you make Cloudflare cache multiple versions of the same resource, using a cookie?

Any Cache-Control headers?

Google Chrome Desktop - Request Headers:

cache-control: no-cache

Google Chrome Desktop - Responset Headers:

cache-control: s-maxage=31536000, max-age=60

Reqbin HTTP Client - Request headers:

no headers are set ...

Reqbin HTTP Client - Response headers:

Cache-Control: s-maxage=31536000, max-age=60

Did the request went through the same IP to your website?

I don’t understand the question. Please clarify. The online HTTP client has its own IP pool. My Google Chrome Desktop is on my region and clearly they have two separate IP addresses.

you say you are using Cloudflare workers too, right?

Yes! a worker to unset the

Vary: User-Agent

HTTP headr.

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