From 008abd9b47bac32e8f686433262dc19c7dfeb15b Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Thu, 15 Apr 2021 06:16:28 +0200 Subject: [PATCH] add cache-control header to images --- next.config.js | 14 ++++++++++++++ package.json | 1 + pages/_app.tsx | 2 +- public/sitemap.xml | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index 20acbe1..c649c24 100644 --- a/next.config.js +++ b/next.config.js @@ -6,4 +6,18 @@ module.exports = { images: { domains: ['localhost', 'cdn.zdamegzaminzawodowy.pl'], }, + async headers() { + return [ + { + source: '/:all*(gif|jpe?g|tiff|png|webp|bmp|svg|ico)', + locale: false, + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=2629746, must-revalidate', + }, + ], + }, + ]; + }, }; diff --git a/package.json b/package.json index c770003..58b235a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "build": "next build", "postbuild": "next-sitemap", "start": "next start", + "start:production": "NODE_ENV=production yarn run start", "codegen": "graphql-codegen" }, "dependencies": { diff --git a/pages/_app.tsx b/pages/_app.tsx index ef16c2b..4173cb6 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,5 +1,5 @@ import '@kichiyaki/roboto'; -import { useEffect, useMemo } from 'react'; +import { useEffect } from 'react'; import { AppProps } from 'next/app'; import ThemeProvider from 'libs/material-ui/ThemeProvider'; diff --git a/public/sitemap.xml b/public/sitemap.xml index efeafc5..ea0d966 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -1,5 +1,5 @@ -https://zdamegzaminzawodowy.pldaily0.72021-04-14T17:52:07.298Z -https://zdamegzaminzawodowy.pl/polityka-prywatnoscidaily0.72021-04-14T17:52:07.298Z +https://zdamegzaminzawodowy.pldaily0.72021-04-15T04:11:26.489Z +https://zdamegzaminzawodowy.pl/polityka-prywatnoscidaily0.72021-04-15T04:11:26.490Z \ No newline at end of file