Skip to content

Cache key configuration for images

By default, smoxy uses a combination of the host, the URI, and a language cookie as the cache key. This means the same image served from different domains (e.g. de.shop.com/logo.png and en.shop.com/logo.png) creates separate cache entries — even though it's the exact same file.

For shops that use different domains per language, this wastes cache space and slows down cache warm-up.


The Fix: Use URI-Only Cache Keys for Images

By changing the cache key for image URLs to use only the URI, all language shops share the same image cache. Benefits:

  • Faster cache warm-up — an image cached for the German shop is immediately available for the English shop
  • Simpler invalidation — one purge request clears the image across all shops instead of one request per domain

How to Set It Up

Create a Conditional Rule that matches image URLs and overrides the cache key:

  1. Navigate to Rules > Conditional Rules

  2. Create a new rule

  3. Set the condition to match image URLs using a regex, for example:

    /.+\.(png|jpeg|jpg|gif|webp|avif)$
  4. In the rule's settings, set Cache Key to uri

  5. Save the rule

This ensures that image requests are cached by their path only, regardless of which hostname served them.