Speed up your WordPress with LWS Optimize and Cloudflare APO

Procédure

Cloudflare APO (Automatic Platform Optimization) is a Cloudflare service designed to speed up the display of websites. Thanks to its integration into LWS Optimize, you can enable and configure it directly from WordPress, without having to create the necessary cache rules yourself in Cloudflare.

Usually, when a visitor views a page, it is your hosting server that is requested to load the page. In most cases, [PERSON_NAME] causes no issues, but if visitors are geographically far from your server (server in France, visitor in Canada, for example), then the request takes [ADDRESS] time.

With Cloudflare APO, the HTML pages of your site are cached directly on Cloudflare's global network. When a visitor views your site, [ADDRESS] page is served from the Cloudflare server closest to their location, without requesting your hosting on each visit. The result is generally a significant reduction in site response time, with a TTFB (page load time, in other words) close to 50 ms in most regions of the world, as well as a significant decrease in the load on your hosting, which no longer has to handle the influx of visitors.

How does Cloudflare APO work?

Once enabled, Cloudflare keeps a copy of the public pages of your site on its servers distributed around the world.

When a visitor requests a page:

  • Cloudflare checks whether a cached version is available.

  • If so, [ADDRESS] page is sent immediately from the closest Cloudflare server.

  • [PERSON_NAME] page is not yet cached or has recently been modified, Cloudflare retrieves a new version from your hosting before updating it.

The system works completely transparently for your visitors.

In order to avoid any issues with personalized content, visitors logged in to WordPress or WooCommerce continue to receive a dynamic version generated directly by your site.

Prerequisites

Before activating this feature, you must have:

  • A Cloudflare account configured for your domain.

  • A Cloudflare API token.

  • The Zone ID associated with your domain.

The API token must have the following permissions:

  • Zone.Cache Purge (Edit)

  • Zone.Cache Rules (Edit)

Enable Cloudflare APO in LWS Optimize

To enable Cloudflare APO, open the LWS Optimize plugin, go to [PERSON_NAME] mode in the CDN tab.

Speed up your WordPress with LWS Optimize and Cloudflare APO

Start by enabling the Cloudflare integration with LWS Optimize option, then save your changes.

Speed up your WordPress with LWS Optimize and Cloudflare APO

This step is mandatory: as long as Cloudflare integration is not active, the APO options remain disabled. Follow this documentation for more information.

Once the integration is enabled, scroll [ADDRESS] page down to the Cloudflare APO — Cache HTML Edge section.

Speed up your WordPress with LWS Optimize and Cloudflare APO

[PERSON_NAME] then:

  • Your domain's Zone ID.

  • Your Cloudflare API token.

Then click the Install Cache Rule on Cloudflare button, then enable the Cloudflare APO option before saving your changes.

What does the “Install Cache Rule” button do?

This button automatically configures Cloudflare so that your site's HTML pages can be cached.

The rule created automatically excludes the areas that should never be cached, including:

  • The WordPress admin area.

  • [ADDRESS] login page.

  • Logged-in visitors.

  • WooCommerce sessions.

  • Cart and checkout pages.

In most cases, no additional configuration is required in Cloudflare.

Cache management

The Cloudflare cache is automatically synchronized with the LWS Optimize cache.

When you modify or publish a post, page, or product:

  • The plugin's local cache is cleared.

  • The Cloudflare cache is also purged automatically.

[PERSON_NAME] thus quickly access the latest version of the content without any manual intervention.

HTML pages are kept for up to 8 hours on the Cloudflare network before being renewed.

Manually clear the cache

In some situations, you may want to force the immediate removal of all Cloudflare cache.

This operation can be performed via WP-CLI with the following command:

wp lwsoptimize cloudflare purge-all

Good to know

[PERSON_NAME] disable Cloudflare APO in LWS Optimize, the cache rule previously created on Cloudflare is not automatically removed.

If you no longer use this feature, you can delete this rule directly from your Cloudflare dashboard.

Conclusion

Cloudflare APO is one of the most effective optimizations for improving a site's performance on a global scale. Once configured, it works fully automatically and generally requires no special maintenance.

For sites receiving visitors from multiple countries or generating significant traffic, enabling it often provides the most visible performance gains with minimal configuration.

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

18mn reading

How can I minimize the files on my WordPress site with LWS Optimize?

13mn reading

How can I combine the files on my WordPress site with LWS Optimize?

15mn reading

How do I preload CSS files on my WordPress site with LWS Optimize?

9mn reading

How do I disable WordPress emojis with LWS Optimize?


Questions sur cet article

Ask the LWS team and its community a question

RGPD : Responsable LWS-Ligne Web Services. Finalité : modération et publication publique de votre question, notification éventuelle d'une réponse. Base légale : consentement (art. 6.1.a RGPD). Conservation des emails : 90 jours après notification, 12 mois maximum sans réponse. Vous pouvez exercer vos droits via notre nos CGV - section RGPD.