Inicio - Documentación - POM Cache - 04 Apache and web server - Keep the original image as a safe fallback

Keep the original image as a safe fallback

WebP negotiation must be additive. The JPEG or PNG remains the canonical fallback for browsers, bots, feeds, email clients, social crawlers, and any request whose edge policy does not support WebP safely.

Do not delete the original after creating its alternative.

Four outcomes to verify

Browser request WebP file Expected body
Accept includes image/webp Exists WebP
Accept excludes WebP Exists Original JPEG/PNG
Accept includes WebP Missing Original JPEG/PNG
No useful Accept header Exists Original JPEG/PNG

The public URL remains the original image URL in every row.

Test a missing alternative

Choose an original image for which no .webp sibling exists.

  1. Request it with Accept: image/webp.
  2. Confirm status, dimensions, and body remain the original.
  3. Confirm Content-Type matches the original extension.
  4. Confirm Apache does not return a 404 for the guessed WebP path.

The existence condition is the fallback mechanism. It should not redirect the browser to a missing filename.

Test an incompatible client

Request a pair that does have a WebP alternative, but omit WebP from Accept.

Expected:

  • the original bytes are served;
  • Content-Type remains image/jpeg or image/png;
  • the response remains visually correct;
  • the edge does not reuse an earlier WebP body.

Test through both origin and CDN. A correct Apache fallback can still be defeated by an edge cache that ignores Accept.

Preserve original-image behavior

Check image features that can be lost during conversion:

  • PNG transparency;
  • embedded color profiles;
  • EXIF orientation;
  • animation;
  • very small icons where WebP may not be smaller;
  • WordPress-generated crops and responsive sizes.

The rewrite cannot determine whether the alternative is semantically equivalent. That is the image pipeline’s responsibility.

Replacement and deletion lifecycle

When WordPress replaces an image:

  1. regenerate every expected WebP sibling;
  2. verify the alternative’s modification time and contents;
  3. remove obsolete alternatives that no longer have an original;
  4. invalidate the public image path at the CDN;
  5. verify both compatible and fallback requests again.

If only the original changes while an older .webp remains, compatible browsers can see different content from incompatible clients.

Cache-key acceptance test

Run requests in both orders:

  1. original-only Accept, then WebP Accept;
  2. WebP Accept, then original-only Accept.

Repeat after the edge is warm. Correct output must not depend on which format populated the CDN first.

Inspect:

  • Content-Type;
  • Vary;
  • edge hit/miss evidence;
  • response size;
  • decoded image format;
  • visible dimensions and transparency.

Roll back without breaking images

To disable the integration:

  1. remove or disable the negotiation rule through the server deployment process;
  2. validate and reload Apache;
  3. invalidate the affected public image paths;
  4. confirm all clients receive the original files;
  5. leave WebP siblings in place until rollback is proven.

Because cached HTML continues to reference the original URL, no POM Cache HTML regeneration is normally required solely to stop same-URL WebP negotiation.