Server Response Time slow?

I’m using Cloufflare on a static file .html
I uploaded it to Github Pages the other day to compare loading speed and server response time.

By making use of I did a test and got the following results:
Github Pages seems to respond generally faster than Cloudflare does. 137ms vs 585ms

With Cloudflare

With Github Pages

Why is this? Any way I can improve this wait time?

If that .html file is in Cloudflare’s cache, it should be way faster than that. Have you looked at the headers to check cf-cache-status? I believe that entry in Pingdom has a small expansion arrow so you can check the headers.

If you set a Page rule on that URL to “cache everything“ You’ll probably see a response time close to 20 ms and a full download time close to 50 ms. I’ve done this on several sites.

I forgot to mention- if you are already optimizing your HTML on the server (minify and compress), then Cloudflare will almost always make that HTML file download slower. This is because Cloudflare has to fetch the HTML from your server for every request, and will then not add any speed value to it. That is why “cache everything“ on a HTML file URL is the only way to make it faster.

Yeah it seems Cloudflare doesn’t cache by default HTML files so I had to add a Page rule to do that. Now it seems to be faster on the 2nd load.

@jules, not quit sure to understand what you mean here: "if you are already optimizing your HTML on the server (minify and compress), then Cloudflare will almost always make that HTML file download slower. "

Why would it make it slower? Cloudflare provides a caching system to deliver those files from the closest node to the visitor.

That’s a popular misconception about CF. By default it does not cache pages, only static resources. Therefore a page request goes like this:
Request: User -> Cloudflare -> Server
Response: Server (build and optimize html) -> Cloudflare (try to optimize html) -> User
So you see with CF in the middle, it will be slower than normal - if you had already done the html optimization on the server. If you did not pre-optimize the html, then CF may be faster by optimizing the html in the middle step.

However with a Page rule to cache that URL, its much different…
Request: User -> Cloudflare
Response: Cloudflare -> User
Typical TTFB under 30ms, full download under 50ms.

Not quite sure what you mean by that. Build what? It’s plain HTML.
Optimice what?

My most I can think of is GZIP, that my server already does. And I minify my external sources myself, so Cloudflare won’t have to do it. HTML minification is worthless as far as I know when using GZIP.

I still do not get a fast response when Clouflare miss the cached file as it has to go to my server first. (500 to 600ms).
I guess that’s the difference between a caching system like Cloudflare or a page published in multiple nodes at the same time, which is what hostings like Nettlify or perhaps even Firebase provide ?

You and I know it’s plain HTML, even static HTML. But Cloudflare can’t assume any “.html” is static. Or any other page extension for that matter. So CF will always hit your server to get a fresh copy of that page.
If you’ve minified and gzipped your html, CF is just in the way. It’s most likely going to slow the page download time (not overall page+resources load time).

The exceptions are:

  1. You did not optimize your html. CF may speed up the resulting download time.
  2. You have a page rule to cache that url. CF will server the html from it’s cache.

I’m sure minification does help overall, regardless of gzip:

  1. Cloudflare will not have to strip out whitespace while optimizing.
  2. User’s browser will not have to strip out whitespace while parsing.

Can you post the URL in question?

See here… the wait time of a cached page url is 20ms. After that, the html loads so fast it doesn’t even register (“Receiving”). This suggests the html loaded within a single round trip, which is very good.

20ms! :open_mouth:
Mine is 103 with Cache on in 2nd reload (HIT) (from Spain)
Do not scroll at all if you want to inspect the network tab with the 1st meaningful paint content. Otherwise other deferred stuff will load (analytics, comments, etc)

That’s not bad. I see 23ms here (NY, USA) with browser cache off, and HIT=yes. Your issue is probably location related. The nearest edge server to me is only about 100 miles away.

37 PM

1 Like

Thanks nice to know! Thanks for your replies!

I’m using plugins to minify the JS, CSS in Wordpress. Cloudflare also uses minify, Should I stop minification by plugins? or can I stop minification by Cloudflare? Will it make it slow? (I’m using page rule to cache everything).

I use Cloudflare’s minification and leave my WP plugin minification turned off. No particular reason I went with this setup, except if I change plugins or whatnot, I know I’m still covered by Cloudflare.

As for slowness, I’m not seeing any. Minification happens in the blink of an eye.

If you’re caching everything, which means the HTML as well, then it doesn’t matter where the minification happens. Generally, pages are dynamic, so you’d want to minify at the server so it can transfer to Cloudflare faster.

1 Like

Receive a greeting.

I found this topic very interesting, since I am dealing with the same problem. I applied the CDN and I manage to lower the TTFB. I use Prestashop for my website, I have optimized the recommendations of the big G and nothing. I opted for the use of the CDN and it remains the same. But I’m still looking to improve the TTFB.

Hi Every body.
I have a big question.
My site : مجله اینترنتی طومار before using CF , TTFB for My site based On GTMETRIX , Location : Vancouver and Browser : Chrome was 500ms.
Since I’ve used CF, this time has reached more than 1 second and its Big problem for me.
Fully Loaded Time : 2.1 S and TTFB is : 1.1s.
Most of this time is Witting.
What should I do ?!

This Is my GTMETRIX Report :

Tried on my end and seems to be <500ms constantly, would you mind posting the link to the report?

I’ve changed a number of settings in CF and the time has improved, and now I have to think to solve the problems that arise in the future.

1 Like

Hi, what configuration have you changed to improve the loading time?

Cloudflare In Iran it is very slow
I tested on my site ( )
But I had to cancel the service
I think it’s because you do not have a server in Iran …

The United States has sanctions towards Iran, that creates issues in sending equipment there.

Note I am in no way affiliated to Cloudflare, in a comment somewhere I believe this was the reason they gave.