Skip to content

Preserving Image Metadata on CDN

Preserving metadata during conversion to WebP

If you need to preserve some metadata in the image, you can do so by setting the VSHCDN-KEEP-METADATA header on the backend.

Supported values

Value Meaning
(header not set) All metadata is removed (default behavior)
copyright EXIF fields Copyright, Artist (author) and Software are preserved. Everything else (GPS, camera data, XMP descriptions) is removed.
all All metadata (EXIF and XMP) is preserved. Only the image orientation is neutralized to prevent double rotation.

Configuring in Nginx

To preserve copyright:

add_header VSHCDN-KEEP-METADATA "copyright";

To preserve all metadata:

add_header VSHCDN-KEEP-METADATA "all";

Configuring in APACHE

The Header set directive requires the mod_headers module to be enabled.

To preserve copyright:

Header set VSHCDN-KEEP-METADATA "copyright"

To preserve all metadata:

Header set VSHCDN-KEEP-METADATA "all"

Configuring in .htaccess

Header set VSHCDN-KEEP-METADATA "copyright"

For the directive in .htaccess to work, configuration overriding must be allowed via AllowOverride. The virtualhost configuration (or the main server configuration) must contain the following for the given directory:

<Directory /var/www/html>
    AllowOverride FileInfo
</Directory>

Notes

  • The setting is applied once the image cache expires, i.e. when the image is fetched from the backend again. You can also selectively purge the cache in the CDN administration interface.
  • The header is only used during conversion to WebP. If the image is already in WebP format, the original image is always sent to the client.
  • In copyright mode, only EXIF metadata is preserved. XMP metadata (image description dc:description, creator dc:creator, rights dc:rights) is removed in this mode — if you need it, use the all mode.
  • Unknown header values are ignored and the default behavior (strip everything) is used.

Preserving metadata when using imgproxy for image manipulation

When using the Image Manipulation API v2, you can use processing options integrated in imgproxy that control metadata preservation per request:

Strip metadata

strip_metadata:%strip_metadata
sm:%strip_metadata

When set to 1, t or true, imgproxy will strip the output image's metadata (EXIF, IPTC, etc.). When set to 0, f or false, the metadata is preserved. The default value is 1 (metadata is stripped).

For more information, see the imgproxy documentation.

keep_copyright:%keep_copyright
kcr:%keep_copyright

When set to 1, t or true, imgproxy will not remove copyright info while stripping metadata.

For more information, see the imgproxy documentation.