fix: handle 301/302 in dev server (#293)

This commit is contained in:
Nate Moore 2021-06-03 11:55:36 -05:00 committed by GitHub
parent deb90dc1d2
commit a2594ef572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);