mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
fix: handle 301/302 in dev server (#293)
This commit is contained in:
parent
deb90dc1d2
commit
a2594ef572
1 changed files with 7 additions and 0 deletions
|
@ -47,6 +47,13 @@ export default async function dev(astroConfig: AstroConfig) {
|
||||||
res.end();
|
res.end();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 301:
|
||||||
|
case 302: {
|
||||||
|
res.statusCode = result.statusCode;
|
||||||
|
res.setHeader('Location', result.location);
|
||||||
|
res.end();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 404: {
|
case 404: {
|
||||||
const fullurl = new URL(req.url || '/', astroConfig.buildOptions.site || `http://localhost${astroConfig.devOptions.port}`);
|
const fullurl = new URL(req.url || '/', astroConfig.buildOptions.site || `http://localhost${astroConfig.devOptions.port}`);
|
||||||
const reqPath = decodeURI(fullurl.pathname);
|
const reqPath = decodeURI(fullurl.pathname);
|
||||||
|
|
Loading…
Add table
Reference in a new issue