Mobile Device Cache

Category: Cache Configuration Available in: CDN > Caching Applies to: Dynamic CDN

Overview

The Mobile Device Cache feature enables device-specific caching by storing separate cache entries for mobile, tablet, and desktop devices. This ensures that users receive content optimized for their device type, without cache conflicts across device categories.

When enabled:

  • The CDN creates separate cache keys based on the detected device type.

  • Two additional headers are added to each request:

    • X-DEVICE: identifies the device type (e.g., mobile, tablet, desktop)

    • X-MOBILE: a boolean-style indicator (true/false) for whether the device is mobile.

These headers are forwarded to the origin to allow dynamic content adaptation if needed.

Use Case

If your website delivers different HTML, layout, or assets depending on the device type, enabling this setting ensures:

  • Accurate cache segmentation (no desktop HTML served to mobile clients)

  • Reduced layout shift and rendering issues

  • Improved user experience and consistency across devices

How It Works

When a request reaches the CDN edge:

  1. Device type is detected using the User-Agent header.

  2. The CDN assigns a cache key that includes the device classification.

  3. The edge forwards X-DEVICE and X-MOBILE headers to the origin.

  4. The origin can log, analyze, or conditionally serve device-aware responses.

Example:

GET /index.html
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X)
→ CDN classifies as 'mobile'
→ Cache key: /index.html|mobile
→ Adds headers:
   X-DEVICE: mobile
   X-MOBILE: true

Configuration

Toggle: Default: Off To enable, switch the Mobile Device Cache setting to On in the caching configuration panel.

Headers Reference

Header
Description
Example

X-DEVICE

Device type detected by CDN

mobile

X-MOBILE

Mobile device boolean indicator

true / false

Limitations

  • Relies on User-Agent detection — edge classification may not be 100% accurate for all custom or rare user agents.

  • Does not support per-resolution caching (e.g., for responsive images by screen width).

Best Practices

  • Use in combination with responsive design or server-side device detection logic.

  • Avoid excessive variation; only enable if content materially differs across device types.

  • Monitor cache hit ratios before and after enabling.

Last updated

Was this helpful?