# Cache key configuration for images

If a site is used for multilingual pages, it is a good idea to adjust the cache key for the images on the page.&#x20;

## Advantages of a dedicated cache key for images&#x20;

By default, smoxy uses a combination of the `Host`, the `URI` and a `language` cookie as the cache key.&#x20;

For example, if the website is an online shop that uses different domains for different languages, several caches would be created for the same image because the host is different.&#x20;

However, this is not necessary. By changing the cache key, only the `URI` can be used as a value. In this way, the image cache for several language shops warms up more quickly and if a product image needs to be exchanged, only one API call is needed to invalidate the cache for this image and not one request per country shop.&#x20;

## Setting a cache key for images&#x20;

As described in the [Page Rules](../../sites/page-rules), every setting in smoxy can be changed based on the URL.&#x20;

A new page rule must therefore be created in which a regex is used as a matcher. This checks whether the URL is an image URL.&#x20;

**Example regex:** `/.+.(png|jpeg|jpg|gif)$`&#x20;

The Cache Key option can then be selected in the settings and overwritten with the value `uri`.

<figure><img src="https://3000458937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNMHyPzupwEpnnrhQdgfe%2Fuploads%2FZYuzoOcIw5WpIcf59bTo%2FCacheKeyImages.png?alt=media&#x26;token=fde0ef64-2b29-4578-9695-bb35872a71a8" alt=""><figcaption></figcaption></figure>
