Skip to content

Integration guide

Prerendering on Akamai EdgeWorkers

Akamai EdgeWorkers run JavaScript at the Akamai edge, integrated with Property Manager rules and Bot Manager. For enterprise sites already on Akamai, this is the natural place to add prerendering — no new vendor, no new operational surface. The integration is a thin proxy: the EdgeWorker detects crawlers and forwards their requests to the prerendering API, which returns ready-to-index HTML.

Setup overview

Deploy an EdgeWorker that detects crawlers by user-agent (combined with Akamai Bot Manager signals where available) and proxies bot requests to the prerendering API: a GET to the rendering endpoint with the page URL in the `url` query parameter, the original bot user-agent in the `bot` query parameter, and your Basic auth token in the `Authorization` header. Note: we have not yet validated this pattern with a production Akamai deployment — treat the example as an API-accurate starting point and test before rollout.

Working snippet

// EdgeWorker sketch — API-accurate, not yet field-tested on Akamai.
// Rendering endpoints: https://github.com/ostr-io/ostrio-docs/blob/master/docs/prerendering/rendering-endpoints.md
// Crawler UA RegExp:   https://github.com/ostr-io/ostrio-docs/blob/master/docs/prerendering/shared/crawler-ua-regex.md
import { httpRequest } from 'http-request'

export async function responseProvider(request) {
  const ua = request.getHeader('User-Agent')?.[0] || ''

  // Detect crawlers via the full UA RegExp (link above). With Bot Manager,
  // combine it with request.botScore.responseSegment.isHuman() to skip humans
  // and request.botScore.responseSegment.isAggressiveResponse() to drop
  // hostile traffic before it consumes renders.
  if (!BOT_RE.test(ua)) {
    return httpRequest(request.url) // humans get the regular SPA
  }

  const pageUrl = request.scheme + '://' + request.host + request.url

  // GET https://render.ostr.io/?url=<encoded page URL>&bot=<encoded bot UA>
  // The bot query parameter forwards the crawler's original user-agent.
  return httpRequest(
    `https://render.ostr.io/?url=${encodeURIComponent(pageUrl)}&bot=${encodeURIComponent(ua)}`,
    {
      headers: {
        // Token from the ostr.io dashboard integration guide, starts with "Basic ..."
        Authorization: 'Basic <your-token>',
      },
    }
  )
}

Decision criteria

Fits when

  • Site is already on Akamai with EdgeWorkers enabled.
  • You have Bot Manager for sophisticated classification beyond user-agent.
  • Compliance requires keeping all edge logic on Akamai.

Decision criteria

Avoid when

  • EdgeWorkers add cost without offsetting indexation gain at your traffic volume.
  • You can run the same logic on Cloudflare or Vercel for less.

Common pitfalls

Watch for these on first rollout

EdgeWorker quota and resource tier

EdgeWorkers have CPU and memory quotas per tier. The bot-routing logic is light, but combining it with other workers can exhaust the budget. Monitor execution metrics in Akamai Control Center.

Property Manager rules conflicting with worker routing

EdgeWorker route() decisions can be overridden by upstream Property Manager rules. Verify that origin selection happens at the EdgeWorker level, not earlier in the rule pipeline.

Bot Manager false positives blocking real crawlers

Aggressive Bot Manager scores can flag Googlebot or Bingbot as suspicious. Combine Bot Score with verified-bot allowlists for major crawlers to avoid accidentally blocking legitimate fetches.

FAQ

Platform-specific questions

What is the EdgeWorker resource tier I should target?

Dynamic Compute tier supports the bot-routing pattern with comfortable margin (128 KB code, 5 ms CPU, 30 MB memory). Free tier is too constrained for production prerender routing — limits will be hit under crawl traffic spikes.

Does Bot Manager replace or complement EdgeWorker logic?

Complements. Bot Manager exposes classification to EdgeWorkers via the botScore object: `request.botScore.responseSegment.isHuman()` confirms human traffic that should get the regular SPA, and `request.botScore.responseSegment.isAggressiveResponse()` flags hostile traffic to drop before it consumes renders. The EdgeWorker combines those signals with the crawler user-agent RegExp to make the final route decision.

How do I roll out incrementally without breaking existing properties?

EdgeWorkers attach to Property Manager rules with a percentage-based traffic match. Start at 1% of bot traffic, monitor `pmuser_x_prerender_decision` log fields for 48 hours, then ramp to 10% → 50% → 100% with rollback on error-rate alerts.

Last updated:

Want this scoped to your stack?

Generic snippets are useful for orientation; the actual integration needs your routes, your bot traffic mix, your cache strategy. The scoping call is 30 minutes — bring the platform constraints.