Skip to content

Latest commit

 

History

History

rewrite

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Netlify examples

Rewrite with Netlify Edge Functions

You can rewrite requests on one URL to resources available on another URL using an Edge Function.

Code example

Edge Functions are files held in the netlify/edge-functions directory.

import type { Context } from "netlify:edge";

export default async (request: Request, context: Context) => {
  return context.rewrite("/something-to-serve-with-a-rewrite");
};

View this example on the web

Deploy to Netlify

You can deploy this and all the other examples in this repo as a site of your own to explore and experiment with, by clicking this button.

Deploy to Netlify