Redirected to an error page on refresh
ntelkedzhiev opened this issue · 0 comments
ntelkedzhiev commented
Can someone explain the code below?
await BP.map(alternativeLanguages, async (lng) => {
const localePage = await generatePage({
language: lng,
path: `${lng}${page.path}`,
routed: true
});
const regexp = new RegExp('/404/?$');
if (regexp.test(localePage.path)) {
localePage.matchPath = `/${lng}/*`;
}
createPage(localePage);
});
When I upload my site to an AWS S3 bucket, it results in the following policy (and I'm redirected to /[LANG]/404 every time I refresh a page).
{
"Condition": {
"KeyPrefixEquals": "en/"
},
"Redirect": {
"HttpRedirectCode": "302",
"ReplaceKeyWith": "en/404"
}
},
{
"Condition": {
"KeyPrefixEquals": "bg/"
},
"Redirect": {
"HttpRedirectCode": "302",
"ReplaceKeyWith": "bg/404"
}
},