From a2594ef572c41ce05dd01ef095e8595ffcd35842 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 3 Jun 2021 11:55:36 -0500 Subject: [PATCH] fix: handle 301/302 in dev server (#293) --- packages/astro/src/dev.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/astro/src/dev.ts b/packages/astro/src/dev.ts index a7da0c863..4321adfaa 100644 --- a/packages/astro/src/dev.ts +++ b/packages/astro/src/dev.ts @@ -47,6 +47,13 @@ export default async function dev(astroConfig: AstroConfig) { res.end(); break; } + case 301: + case 302: { + res.statusCode = result.statusCode; + res.setHeader('Location', result.location); + res.end(); + break; + } case 404: { const fullurl = new URL(req.url || '/', astroConfig.buildOptions.site || `http://localhost${astroConfig.devOptions.port}`); const reqPath = decodeURI(fullurl.pathname);