jsJ
Denoβ€’2y agoβ€’
8 replies
js

Route redirect handlers

I tried using this code to redirect a route to another route.

export const handler: Handlers = {
  GET(_req: Request, _ctx: FreshContext) {
    const headers = new Headers();
    headers.set('location', '/c/xyz');
    return new Response(null, {
      status: 302,
      headers,
    });
  },
};


It works-- its loading "/c/xyz" (correctly, as it should). But the URL doesnt' change. Is there a way to make this work AND change the URL?
Was this page helpful?