Skip to content

Cloudflare for PrestaShop — real benefits and limits

Mateusz Bartocha

  • Cloudflare
  • PrestaShop
  • performance
  • security
  • CDN
  • DevOps

Cloudflare is one of a store's most common “quick wins” and, at the same time, one of the most misunderstood. Put in front of PrestaShop it can take a large share of image and static-asset traffic off the server, speed up delivery for users in distant regions, and deflect some bot traffic — usually already on the Free plan. What it won't do is speed up a slow checkout, fix SQL queries with no indexes, or secure a server whose origin still answers the entire internet. Below we show what this pairing does in practice, where the benefit's limits are, and which deployment mistakes most often ruin the result.

What role Cloudflare plays in front of the store

Cloudflare works as a reverse proxy and CDN placed in front of the store's server. All traffic reaches the Cloudflare network first and only then, if needed, goes on to your origin. Static assets — images, CSS, JavaScript, fonts — can be served from a node close to the user, without involving the server. Dynamic requests, meaning everything PrestaShop generates per user, still go back to the origin.

Let's set the proportions straight up front: this is not a “for PrestaShop” integration. Cloudflare sits the same way in front of WordPress, Laravel, or any other PHP application. So most of what we describe applies to any store behind such a proxy, and what makes PrestaShop stand out comes from the nature of the store itself, not from special support on Cloudflare's side.

Why PrestaShop's architecture benefits from it

How much Cloudflare helps is decided by a given store's traffic profile. A typical PrestaShop means lots of product photos, each in several size variants, plus the theme's CSS, JavaScript and fonts, crawler traffic indexing the catalog, expensive dynamic PHP and MySQL requests, periodic traffic spikes during promotions, and plenty of modules and endpoints.

From that setup comes a simple relationship worth keeping in mind behind every promise of a speed-up:

  • The larger the share of images and static files in transfer, the more work the edge takes over.
  • The larger the share of costly dynamic HTML, the smaller the impact of the CDN alone.
  • Cloudflare can reduce the number of requests reaching the origin, but it doesn't lower the cost of the dynamic requests that still arrive there.

The key benefits (and their limits)

The benefits of Cloudflare in front of a store are concrete, but each has its boundary condition. Here's what you usually see in practice — without promises this layer can't keep.

Less traffic and transfer on the origin. Caching static files reduces the number of requests and the volume of data the server has to handle itself. The biggest effect shows up on images and other static assets, and on traffic Cloudflare stops before the server. Don't assume an automatic CPU drop, though: simply sending a static file rarely loads PHP or MySQL, so you mainly save on connections, transfer, and web-server work.

Faster assets for users in distant regions. Images, CSS files, JavaScript and fonts can be fetched from a Cloudflare point closer to the user rather than from the origin every time. That shortens the load time of those assets, but not the time to generate the dynamic page — that still depends on your server.

More resilience to some traffic spikes. When traffic grows on what can be served or rejected at the edge, the origin takes a smaller hit. The caveat matters: a sudden surge of non-cacheable requests such as the cart, API, or search can still overload the backend, because those go straight to PHP and the database.

Filtering out some bots and attacks. Caching limits repeat fetches of static assets, and bot-protection mechanisms stop some unwanted traffic before the server. Just be careful not to block legitimate crawlers without analysis — Googlebot fetches dynamic HTML anyway, so the claim that “the crawler loads the origin less” is not unconditional.

A security layer in front of the server. Cloudflare can stop part of the scanning, automated attacks, abuse attempts and overloads before they reach PrestaShop. It does not, however, fix a vulnerability in a module or replace updating the store and server; a flaw in the code still has to be closed on your side.

Images: transformations at the edge. Cloudflare can process images on the fly — resize, crop, optimize and deliver a modern format — without keeping every variant on the server. As of this article's last update, the Free plan includes up to 5,000 unique transformations per month, where “unique” means a combination of the source image and its parameters, not every view. Once you exceed the limit on Free, previously made transformations keep being served from cache and only new ones are rejected. It's a practical alternative to generating all thumbnails on the store side.

PrestaShop can generate optimized formats itself, while Image Transformations create size and format variants at the edge without storing every version on the origin. Which to choose depends on the number of photos and variants, available space, CPU cost, and how images are managed in the store — neither option wins every time.

Extra data and observability. You also get insight into traffic: statistics, security events, and information on what is being rejected and cached. That's the material that later lets you judge whether the deployment actually did anything — which we come back to at the end.

One note on the stack: Cloudflare sits in front of nginx, Apache and LiteSpeed the same way. HTTP/3 here concerns the connection between the user and the Cloudflare network, and does not automatically mean the origin also speaks HTTP/3.

Cloudflare: Image Transformations (source) PrestaShop performance optimization

What Cloudflare won't fix

Cloudflare is a layer in front of the server, so everything that happens on the server itself stays on your side. It won't speed up slow controllers, unindexed queries, bloated modules, or an overloaded PHP-FPM and MySQL. It won't help when a page is slowed by an external API blocking its generation, excess JavaScript in the theme, weak hosting, a slow checkout, poorly prepared source images, or Core Web Vitals problems (the metrics for how well a page loads) arising from rendering and interaction.

That's why Cloudflare doesn't replace optimization on the store side. Redis, PrestaShop's cache, OPcache, database indexes, order in the modules, and correct PHP configuration are still needed. Those things solve problems on a different layer than a CDN, and one without the other isn't enough.

Don't count on caching the whole HTML “out of the box” either. Automatic Platform Optimization, which does this for WordPress, has no ready integration with PrestaShop; a similar effect has to be built yourself, together with correct cache invalidation. The simplest rule to remember: if an anonymous page is slow because the origin takes long to generate it, the edge layer won't shorten that. Measure first where you're losing time — if the bottleneck is the backend, Cloudflare isn't the answer.

Cloudflare: Automatic Platform Optimization (source) Why PrestaShop runs slow

The Free plan and when a paid plan is worth it

For many stores the Free plan is a good starting point. You get a CDN and static caching, basic security mechanisms, HTTP/3, the ability to build your own rules, and — less obviously — the 5,000 unique image transformations per month mentioned above. That's usually enough to get going and see how much you gain in practice.

You reach for a paid plan in response to a concrete need, not “on principle.” It's usually one of these situations:

  • more advanced bot protection,
  • a store that is actually being scanned or scraped,
  • more control over WAF rules,
  • more or more elaborate rules,
  • scaling image transformations beyond the free limit,
  • advanced caching features,
  • business requirements and a need for support.

The most common deployment mistakes

Most problems with Cloudflare in front of PrestaShop don't come from Cloudflare itself, but from a deployment stopped halfway. Two of these mistakes show up most often and bite hardest in production, so we'll start with them.

An exposed origin. Setting the “orange cloud” in DNS does not stop the server from accepting connections directly. The origin address is often known from DNS history, mail headers, old “DNS only” records, or other services on the same server — and anyone who knows it can send requests that bypass Cloudflare, and with it the cache, WAF, and rate limiting. On your own VPS or dedicated server, HTTP and HTTPS traffic should be accepted only from Cloudflare's ranges and from the integrations you actually rely on; account for both IPv4 and IPv6, and prepare separate exceptions for monitoring or callbacks. The allowlist alone is a useful layer, but Cloudflare classifies it as “moderately secure”; a stronger option is Authenticated Origin Pulls, which let the origin verify that a request came from the Cloudflare network, or Cloudflare Tunnel. The key takeaway: simply connecting your domain to Cloudflare does not protect the server from direct traffic.

An unrestored real visitor IP and a stale fail2ban. Behind a reverse proxy the server sees connections from Cloudflare addresses, and receives the real client address in a header (among others, CF-Connecting-IP). If you don't restore it, logs, geolocation, anti-fraud rules, server-side rate limiting, and maintenance mode will see Cloudflare addresses instead of clients. On Apache this is done with mod_remoteip, on nginx with the Real IP module and a list of trusted Cloudflare ranges — and that header may be trusted only when the connection originated from a trusted Cloudflare address, otherwise it can be forged. The same applies to fail2ban. It's not that it needs “updating because Cloudflare arrived”; after deployment you have to review how it reads the client address from logs, which trusted ranges it knows, and how it enforces bans. The key nuance: a ban on the origin firewall may stop working, because the connection to the server is made by Cloudflare, not the user — so bans have to happen either at the application and web-server level after the address is restored, or be pushed to Cloudflare via the API as rules acting at the edge. Cloudflare explicitly warns, in fact, that without the restored address fail2ban can accidentally block Cloudflare's own addresses and cause errors for many users at once.

The remaining mistakes are less spectacular but just as costly:

  • Treating connecting the domain as the end of the deployment — the rest of the settings stay default and part of the protection doesn't apply. A deployment is a configuration, not a DNS-record change.
  • Forcing cache on dynamic HTML — a risk of showing someone else's cart or account. Cache static assets, and keep transactional pages and the admin panel out of cache.
  • Flexible SSL instead of Full (strict) — with SSL enabled in PrestaShop this ends in a redirect loop and mixed content. Set the Full (strict) mode.
  • Enabling every “speed-up” without testing — aggressive JavaScript optimization can break the theme, cart or modules. Enable them one at a time and check the front after each change.
  • Not verifying integrations — payments, ERP, marketplaces and monitoring may run from addresses you've just cut off or pushed through the WAF. Verify them after deployment.
  • No measurement before and after — without a baseline you don't know whether anything changed. Collect metrics from the origin and from Cloudflare (see below).

Cloudflare: protect your origin server (source) Cloudflare: restoring original visitor IPs (source) Cloudflare: fail2ban and Cloudflare IP ranges (source) DevOps and infrastructure

How to tell whether the deployment did anything

Since we're talking about benefits, it's fair to show how to confirm they actually happened. You don't need benchmarks or impressive percentages in a slide deck — it's enough to watch a few metrics before and after deployment:

  • outbound transfer from the origin — how much data the server sends itself,
  • the number of requests reaching the origin,
  • cache hit ratio on the Cloudflare side,
  • TTFB (time to first byte) for dynamic HTML — this shows whether the problem is on the backend,
  • LCP (time to render the main content) and the other Core Web Vitals,
  • the number of 5xx errors,
  • security events and traffic rejected before the origin.

Frequently Asked Questions

Will Cloudflare fix a slow store?

Only partly, and not where it usually hurts. It offloads static delivery and filters some traffic, but dynamic pages — cart, checkout, account — are still generated by your server. If they're slowed by code, SQL queries without indexes, or a heavy module, the problem is on the store side and that's where it has to be fixed. Cloudflare complements optimization, it doesn't replace it.

Is the Free plan enough for a PrestaShop store?

For many stores, at the start, yes. It gives you a CDN, static caching, HTTP/3, basic security, your own rules, and a free image-transformation allowance. You move to a higher plan when you hit a specific ceiling: more serious bot protection, scraping, more control over the WAF, or scaling images beyond the free limit.

Can Cloudflare break the cart or show someone else's account?

It can, if you force caching of dynamic pages yourself. By default Cloudflare doesn't cache the store's HTML, so the cart and account are safe. The risk only appears when a broad rule tells it to cache everything — which is why transactional pages and the admin panel must stay out of cache.

Does APO work with PrestaShop?

Not in a ready-made form. Automatic Platform Optimization has an integration for WordPress; for PrestaShop there's no such “out of the box” solution. A similar HTML caching can be built yourself, but it requires your own configuration and — the harder part — correct cache invalidation.

Do you need to change the fail2ban configuration after deploying Cloudflare?

Usually it's worth reviewing. First, fail2ban has to read the real client address from the logs, not the Cloudflare address, which requires restoring Real IP first. Second, a ban on the origin firewall may no longer work, because the connection is made by Cloudflare; it's more effective to ban at the application level or push decisions to Cloudflare via the API. Without this it's easy to accidentally block Cloudflare's own addresses.

Can you still reach the server's IP directly after connecting Cloudflare?

By default yes — and that's the problem. Connecting your domain to Cloudflare doesn't close direct access to the origin. Until you restrict traffic to Cloudflare's ranges (or use Authenticated Origin Pulls or Tunnel), anyone who knows the server's address can bypass the whole protective layer.

What do Image Transformations give you on the Free plan?

They let you process images at the edge — resize, crop, optimize, and deliver a modern format — without keeping every variant on the server. As of this article's update, the free allowance is 5,000 unique transformations per month, counted by the combination of image and parameters; repeat views of the same variant aren't recounted. It's a way to reduce the number of thumbnails the store itself generates and stores.

Does this guide only apply to PrestaShop?

No. Cloudflare sits the same way in front of WordPress, Laravel, or another PHP application, so the cache, origin-protection and IP-restoration principles carry over directly. We take the examples from PrestaShop because that's the platform we work with day to day, but the edge layer itself is nothing “PrestaShop-specific.”

We'll deploy Cloudflare in front of your PrestaShop — sensibly

We'll configure caching for the store, secure the origin, restore the real IP, and set up fail2ban to work behind the proxy. And if the problem is on the server side, we'll say so plainly instead of selling you a higher plan — we start with measurement, not with turning everything on at once.