Add in-memory caching for online count, enable compression, and add staleTimes for router cache
This commit is contained in:
1 parent
b058a3827b
commit
deac10e00a
5 files changed
+51
-10
No files matched your search
+24
-5
@@ -29,20 +29,39 @@ const securityHeaders = [
|
||||
];
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// This app lives inside the Laravel repo tree (which has its own lockfiles);
|
||||
// pin the Turbopack root so Next doesn't infer a parent directory.
|
||||
turbopack: { root: import.meta.dirname },
|
||||
|
||||
// Prisma + the MariaDB driver adapter are native/server-only — keep them out
|
||||
// of the bundle (same approach as the habbo-next reference).
|
||||
serverExternalPackages: ["@prisma/adapter-mariadb", "mariadb", "@prisma/client"],
|
||||
|
||||
// Compress responses with gzip
|
||||
compress: true,
|
||||
|
||||
// Cache pages longer in the router cache for faster back/forward navigation
|
||||
experimental: {
|
||||
staleTimes: {
|
||||
dynamic: 30,
|
||||
static: 180,
|
||||
},
|
||||
},
|
||||
|
||||
// Add caching headers for static assets
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)",
|
||||
headers: securityHeaders,
|
||||
},
|
||||
{
|
||||
source: "/assets/(.*)",
|
||||
headers: [
|
||||
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
|
||||
],
|
||||
},
|
||||
{
|
||||
source: "/images/(.*)",
|
||||
headers: [
|
||||
{ key: "Cache-Control", value: "public, max-age=86400" },
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user