How does an origin trigger prefetching?

Akamai sends specific information to your origin to initiate prefetching. Your origin must include a properly formatted response header after this request, to trigger prefetching.

Phase 1: Akamai tells your origin Prefetching is enabled

Akamai handles a player request for content and sends a prefetch request header to your origin, telling it that Prefetching is enabled:

CDN-Origin-Assist-Prefetch-Enabled: 1

Phase 2: Your origin responds to Akamai with what to prefetch

Your origin needs to use the Akamai request header to trigger prefetching. Your origin must send a prefetch response header that tells Akamai what should be prefetched. This response header must be comprised of the absolute or relative path to the object to be prefetched, followed by the Content-Length header stating the length of the complete prefetch response header.

CDN-Origin-Assist-Prefetch-Path: <absolute|relative path of prefetch-able object's URL>
Content-Length: x

Akamai creates the full URL for the object to be prefetched by using:

  • The player-requested URL of the current object, and
  • The relative or absolute path listed in the prefetch response header.

Absolute path examples

Specify an absolute path by prefacing it with forward slash. This tells Akamai to use the exact path specified.

URL of player that initiated the request Value of the response header from the origin (used to trigger prefetch) URL of a request prefetched from Akamai
https://property-hostname/some/1234/video-100k/pl.m3u8 /hls/live/1234/video-100k/seg1.ts https://property-hostname-from-player-request/hls/live/1234/video-100k/seg1.ts
https://property-hostname/thing/1234/video-100k/seg1.ts /hls/live/1234/video-100k/seg2.ts https://property-hostname-from-player-request/hls/live/1234/video-100k/seg2.ts
Note: In these examples, both property-hostname and property-hostname-from-player are the HTTP/1.1 "Host" header as seen by Akamai.

Relative path examples

Specify a relative path by leaving out the forward slash from the beginning of the path. Akamai uses the forward path of the current request, minus the filename as the base path when creating the prefetch URL path.

URL of player that initiated the request Value of the response header from the origin (used to trigger prefetch) URL of a request prefetched from Akamai
https://property-hostname/some/1234/video-100k/pl.m3u8 video-100k/seg1.ts https://property-hostname/some/1234/video-100k/seg1.ts
https://property-hostname/thing/1234/video-100k/seg1.ts seg2.ts https://property-hostname/some/1234/video-100k/seg2.ts
Note: In these examples, property-hostname is the HTTP/1.1 "Host" header as seen by Akamai.

Example 1: Include a single "prefetchable" path per response header

The origin uses individual instances of the prefetch response header to include a single object to be prefetched.

CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8
Content-Length: x

If multiple objects are to be prefetched, then one response header per prefetchable URL can be returned by origin. Ensure that all response headers use the same name. The order of these headers determines the order Akamai follows to request each object.

CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x
Note: Middle layer proxies may not preserve this ordering of response headers, and content may not be delivered in the desired order.

Example 2: Include multiple "prefetchable" paths in a single response header

The origin uses a single instance of the prefetch response header to include a comma-separated list of multiple objects to be prefetched.

CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8,/hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x

The order of the paths listed determines what is prefetched first. (Since this is only a single response header, the issue with middle layer proxies doesn't apply.)

Phase 3: Akamai requests the prefetched object for the player

With a "prefetch object" determined by the response header from your origin, Akamai requests it, as if it was requested by the player. To allow your origin to differentiate a prefetch request from a regular request all prefetch requests from Akamai use the same request header:

CDN-Origin-Assist-Prefetch-Request: 1

Once Akamai receives the prefetch object, it caches it until the player requires it.

Along with sending the prefetch object to Akamai, you can also have your origin send a new response header to prefetch the next object in the queue, if applicable.