Welcome! Edge Functions can be used with Next.js to modify cloud function responses at the edge.

The request workflow without Edge Functions is:

  1. The browser will request the page
    /example
    .
  2. Edgio will match this request as defined in the
    routes.ts
    file and process it through Next.js as a cloud function.
  3. The Next.js server will render the page and the response will be sent to the browser.
View original Cloud Function page
(go to
/example
)

The request workflow with Edge Functions is:

  1. The browser will request the page
    /example?edge=1
    .
  2. Edgio will match this request as defined in the
    routes.ts
    file and process it through
    ./edge-functions/index.js
    .
  3. The edge function will issue a fetch request to the
    edgio_serverless
    origin, forwarding the original request to the Next.js cloud function.
  4. The Next.js server will render the page and respond to the edge function.
  5. The edge function will modify the response, replacing
    Edgio Cloud Functions
    with
    Edgio Edge Functions
    , and send it to the browser.
View Edge Function page
(go to
/example?edge=1
)
View Source Code