Mobile app version of vmapp.org
Login or Join
Gail5422790

: Long waiting time on page load may be caused by https? As the screenshot show, there is 1.05s waiting time on page load and I have done some tests to figure it out that this is caused

@Gail5422790

Posted in: #Https #LoadTime #SecurityCertificate

As the screenshot show, there is 1.05s waiting time on page load and I have done some tests to figure it out that this is caused by https.

I uploaded a plain html with just hello world and tested with both http and https, with http the wait time was just around 300ms while with https it was around 1s.

Does anyone know why and how to optimize that? I have researched a lot and confirmed that the server is running http/2, keep alive is on, and static contents caching is on.

Is there anything I can do to improve the wait time? Any advice would be appreciated.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gail5422790

1 Comments

Sorted by latest first Latest Oldest Best

 

@LarsenBagley505

Cloudflare by default does not cache HTML content. I suggest that you write a Page Rule to cache static HTML. Here we go:


login to your cloudflare account
using the dropdown in the top-left, select your domain name
click the page rules app in the top of the menu
(for added convenience and clarity, the icon below is exactly what you're looking for):





Next, create a pattern & then apply a rule to that pattern. This
requires you find a way to distinguish static vs. dybamic content by
the URL. Some possibilities of accomplishing this are included
below:


option a. to create a directory for static content, append a unique extension to static pages:


example.com/static/ [/static/ subdirectory for static HTML pages]


option b. appending a unique file extension to static pages:


example.com/.shtml [.shtml file extension to signify HTML that is static]


option c. adding a query parameter to mark the content as static:


example.com/?static=true [adding static=true query parameter]


The objective is to design the pattern to ONLY describe pages you know are static, of course.


Click Cache everything in the Custom caching dropdown menu.
Click Add Rule.


If at this point your HTML is not being cached, despite the cache everything rule, it means you need to override the origin cache directive with an "Edge Cache TTL" setting. Be sure that you set the edge cache TTL in Cloudflare even if the origin is sending the correct cache TTL headers - because again - Cloudflare will not cache HTML by default.

Hopefully this helps!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme