Add Cache-Control max-age headers globally

This commit is contained in:
2022-09-19 23:38:07 +02:00
parent e0b28551b8
commit 3a7056cce6
3 changed files with 8 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import { fetchAPI } from '$utils/api'
import { PUBLIC_PREVIEW_COUNT } from '$env/static/public'
export const load: PageServerLoad = async () => {
export const load: PageServerLoad = async ({ setHeaders }) => {
try {
const res = await fetchAPI(`query {
locations: location (filter: { status: { _eq: "published" }}) {
@@ -87,6 +87,8 @@ export const load: PageServerLoad = async () => {
}`)
if (res) {
setHeaders({ 'Cache-Control': 'public, max-age=3600' })
const { data: { countPhotos, countLocations, countCountries, ...rest }} = res
return {