WebCare.

WordPress problem fix

CLOUDFLARE 522 IMAGE ERRORS AFTER NITROPACK ON WORDPRESS?

NitroPack and Cloudflare can fight over your images. We get both working together without rolling either back.

4 hour emergency response You only pay when it is fixed 150+ WordPress sites managed

The short answer

If your WordPress site started returning Cloudflare 522 timeout errors on images after installing NitroPack, the two layers are racing each other. NitroPack proxies images through its CDN, then Cloudflare in front times out waiting for the origin response on a cache miss. The fix is to align the two: configure NitroPack to bypass Cloudflare for its image domains, or move image optimization off NitroPack and into Cloudflare Polish, then warm the cache. Most sites are stable again the same day.

Is this your situation?

If any of these match, you are on the right page.

Random images return Cloudflare 522 errors

First load after deploy is broken, second load is fine

It started right after enabling NitroPack

Mobile users see broken images more than desktop

What usually causes it

Why does NitroPack cause 522 errors with Cloudflare?

NitroPack adds its own CDN layer for images. With Cloudflare in front, the request goes Cloudflare to NitroPack to origin, and if origin or NitroPack stall on a cache miss, Cloudflare times out and shows 522.

Can I just turn off Cloudflare?

You can but you lose DDoS protection and SSL termination. Better to align the two so they cooperate.

Is this a NitroPack bug?

No, it is a layering issue. Two CDNs in series need explicit configuration to avoid timing races. Both vendors document it.

How we fix it

The real method, in the order it works.

  1. 1

    Identify which domain serves your images (origin, nitrocdn, or Cloudflare).

  2. 2

    In Cloudflare, set the image domain to Bypass on cache miss or increase origin timeout above 100 seconds.

  3. 3

    In NitroPack, enable Cloudflare compatibility mode under Integrations.

  4. 4

    Purge both caches, warm the homepage and 10 highest traffic URLs.

  5. 5

    Monitor real user errors for 24 hours through Search Console or Sentry.

Real fix, from our work

How this one actually went down

A UK marketing network with 30 plus WordPress sites started showing Cloudflare 522 errors on images after a NitroPack rollout. The two CDNs were fighting on cache misses. I enabled NitroPack Cloudflare compatibility, set the nitrocdn subdomain to bypass on miss in Cloudflare, purged everything, then warmed the cache from a fresh IP. Errors stopped inside an hour. Average LCP also improved by 0.4 seconds because the layers stopped duplicating work.

AJ

Written by Ali Yasin Jatoi

Founder of WebCare Studios. Ali has worked with WordPress for more than 10 years, including managing a fleet of 150+ sites with WP-CLI automation for updates, security cleanup, and malware removal. He has hands on experience across major hosts including Cloudways, A2 Hosting, Hostinger, and Bluehost.

Why owners pick WebCare

4 hour emergency response

Site down, hacked, or broken checkout gets a senior engineer within 4 hours. No ticket queues, no bots.

You only pay when it is fixed

Flat quote up front. If we cannot get you back online, you do not pay. Risk sits with us, not you.

Data safe approach

We work on a snapshot first and never touch your live database until the fix is verified safe.

150+ sites managed

We run a fleet of WordPress sites every day. The errors you are seeing are ones we have closed hundreds of times.

Common questions

Should I pick NitroPack or Cloudflare, not both?+

Both, configured correctly, gives the best result. NitroPack handles image optimization and critical CSS, Cloudflare handles edge caching and security. The issue is misconfiguration, not the combination.

Will I lose Core Web Vitals improvements?+

No. Once aligned, LCP and CLS usually improve because the layers stop duplicating work. We measure before and after on every project.

Can the same happen with WP Rocket?+

Yes. Any plugin that fronts images with its own CDN can race with Cloudflare. The fix pattern is the same: explicit compatibility mode and matching cache rules.

Send my site for triage in 15 minutes

Two fields. Email and your URL. A senior WordPress engineer reads it within minutes and replies on email and WhatsApp with what is wrong and what we will do next.

Two fields. Senior engineer replies within 15 minutes during business hours.

Related fixes

WhatsApp Get my site fixed