Move setting Cache-Control to try block

This commit is contained in:
Maciej Pędzich 2024-07-28 21:31:07 +02:00
parent cd9b4b2a8b
commit a839f8f998
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D

View File

@ -24,12 +24,12 @@ try {
if (noEmptyParams && paramsNotEqual)
graphProps = await getShortestPaths(source, dest);
} catch (error) {
return Astro.redirect('/error');
}
// Cache the page for 2 weeks
Astro.response.headers.set('Cache-Control', 'public, max-age=1209600');
} catch (error) {
return Astro.redirect('/error');
}
---
<BaseLayout>