Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your Image CDN Picks the Format. Here's How to See What It Actually Sends

Here is one image URL from a real Shopify store, requested three times. Same URL, same second, three different files: https://jellinator.com/cdn/shop/files/ShotCups_100Pack.png?width=1200 Chrome (AVIF+WebP) image/webp 87 KB Vary: Accept WebP only image/webp 87 KB Vary: Accept Old browser image/png 1223 KB Vary: Accept The only thing that changed between the three requests is the Accept header. A…

Image CDN services are selecting the appropriate format for images. To determine what format is actually sent, one can observe the Accept header present in browser requests. For instance, a Chrome browser sends: Accept: image/avif,image/webp,image/apng,image/*,*/*;q=0.8. An image CDN reads this list and provides the best format it can produce, adding Vary: Accept to the response.

If the Vary: Accept header is absent, the same file is delivered regardless of the header. To check a batch of images, a small script can be used that sends three HEAD requests for each URL and displays the format, size, and Vary header for each client. However, it's crucial to note that not all tools fetch images using a browser-like Accept header, resulting in the "old browser" version being retrieved instead.

This can lead to incorrect reports of issues that the visitor never experiences. Additionally, some servers may respond differently to HEAD requests compared to GET requests. When testing on multiple widths, the format can also change, which should be considered. It's essential to verify which Accept header the tool used when reading an image audit, as the numbers reported may not reflect what visitors actually see.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I Built an Offline Contract Risk Analyzer That Flags the Clauses That Cost You the Most

Last month a friend signed a 12-month SaaS contract without reading clause 14. It auto-renewed for another year and the early-termination fee was three months of subscription.

  • ClauseGuard is a Python-based offline contract risk analyzer.
  • Tool flags high-risk clauses like auto-renewal traps and uncapped indemnities.
  • ClauseGuard generates HTML reports for contract review before signing.

How a WordPress WhatsApp plugin talks to Meta's Cloud API

Adding WhatsApp to a WordPress site usually means a chat button or a separate SaaS dashboard. A third route is a plugin that talks to Meta's WhatsApp Business Cloud API straight from your own server.

  • WordPress site can use WhatsApp plugin communicating directly with Meta's Cloud API
  • Plugin receives customer messages via webhook, processes replies through REST API
  • Contacts, conversations, consent records stored securely in WordPress database

Loops in JavaScript

What Are Loops? Loops are used to execute a block of code repeatedly until a condition is no longer satisfied or the loop is otherwise stopped.

  • Loops in JavaScript execute code blocks repeatedly until a condition is met.
  • Common loop types: for, while, do...while, for...of, for...in.
  • For loop: used when number of repetitions is known beforehand.

More from Monday 12 October →