module.exports = {
  cacheComponents: true,
  cacheHandlers: {
    redis: require.resolve("./cache/handlers/redis.js"),
  },
  allowedDevOrigins: ["127.0.0.1"],
  experimental: {
    viewTransition: true,
  },
  async rewrites() {
    return [
      {
        source: "/@:handle/:path*",
        destination: "/at/:handle/:path*",
      },
      {
        source: "/@:handle",
        destination: "/at/:handle",
      },
    ];
  },
  async headers() {
    return [
      {
        source: "/:path*.(png|jpg|jpeg|ico|svg|webp)",
        headers: [
          {
            key: "Cache-Control",
            value: "public, max-age=86400, stale-while-revalidate=604800",
          },
        ],
      },
    ];
  },
};
