Limited Time Free!  Experience website acceleration and advanced security protection!
Get Started Now 

Request Redirct

In this case, an Edge Function is used to implement the redirection of the request, returning a 302 response to the client.

Code

const REDIRECT_URL = 'https://edgeone.ai';

async function handelRequest() {
  return Response.redirect(REDIRECT_URL)
}

addEventListener('fetch', (event) => {
  event.respondWith(handelRequest(event.request))
});

Preview

Xnip2024-07-02_18-06-04.png

References