Skip to main content

Cache control

Revalidation

The module sends an ETag when the source image sends one. The value comes from the commands and from the source's validator. A change to either one changes the value. The module forwards Last-Modified from the source.

The module reads If-None-Match and If-Modified-Since. On a match it returns 304 with an empty body. It does not decode, transform, or encode the image. The 304 has the same Cache-Control and Expires as the full response.

DimsCacheExpire

DimsCacheExpire 604800

How long a successful response may be cached, in seconds, when the origin says nothing. Default 86400.

Sets Cache-Control: max-age, Expires, and Edge-Control: downstream-ttl.

DimsNoImageCacheExpire

DimsNoImageCacheExpire 60

How long an error image may be cached, in seconds. Default 60.

It is short on purpose. A long one caches a failure across a whole CDN.

DimsErrorBackground

DimsErrorBackground "#cccccc"

Draws the image a failed request answers with, in this colour, at the size the commands asked for. A page that asked for 100 by 100 gets 100 by 100 whether the request succeeded or not.

Any colour ImageMagick reads works, as a name or a hex value.

It takes precedence over DimsDefaultImageURL, and needs no fetch.

DimsDefaultImageURL

DimsDefaultImageURL https://images.example.com/missing.png

The image sent when a request fails, for clients whose own error image is unset.

A single dash means none. Without an error image a failure returns its status and no body, which is often what a caller would rather have.

A file:/// URL is read from disk instead of fetched.

Trusting the origin

The trust, minSrc, and maxSrc fields of DimsAddClient decide whether the origin's own Cache-Control is used, and the range it is clamped to. An origin asking for a year is clamped to maxSrc, and one asking for a second is raised to minSrc.

DimsOriginStatusMode

DimsOriginStatusMode map

How a failure at the origin reaches the caller.

ValueEffect
forwardreport the status the origin returned. The default.
mapreport 404 for a missing source, 504 for a timeout, and 502 for anything else

forward tells a caller what the origin said, which also tells them whether a host exists, whether it wants credentials, and whether a port is filtered. map reports one of three answers and nothing else.