mirror of
https://github.com/withastro/astro.git
synced 2025-02-24 22:46:02 -05:00
fix: lost the leading slash when redirecting
This commit is contained in:
parent
4854a3f612
commit
a64f4fec32
1 changed files with 3 additions and 1 deletions
|
@ -115,9 +115,11 @@ async function handle404Response(
|
|||
const redirectTo =
|
||||
req.method === 'GET'
|
||||
&& config.base && config.base !== './'
|
||||
&& pathname.replace(config.base, '');
|
||||
&& pathname.startsWith(config.base)
|
||||
&& pathname.replace(config.base, '/');
|
||||
|
||||
if (redirectTo && redirectTo !== '/') {
|
||||
console.log('redirecting', pathname, redirectTo);
|
||||
const response = new Response(null, {
|
||||
status: 302,
|
||||
headers: {
|
||||
|
|
Loading…
Add table
Reference in a new issue