Files
meezi/web/koja/next.config.ts
T
soroush.asadi 2203ecbdaf
CI/CD / CI · API (dotnet build + test) (push) Failing after 3m18s
CI/CD / CI · Admin API (dotnet build) (push) Failing after 2m22s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m5s
CI/CD / CI · Admin Web (tsc) (push) Successful in 36s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Has been skipped
fix(koja): remove over-broad short-URL redirect that 500'd the home page
The redirect source "/:slug([a-z0-9][a-z0-9-]*[a-z0-9])" matched single-segment
paths including the locale itself, so /fa redirected to /fa/cafe/fa (slug "fa")
and /en to /fa/cafe/en — non-existent cafés that returned Internal Server Error.
Visiting koja.meezi.ir (-> /fa) hit this. Removed the redirect so the home page
renders; short café URLs can be re-added via middleware with reserved-word guards.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 08:29:27 +03:30

61 lines
1.8 KiB
TypeScript

import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
import withPWAInit from "@ducanh2912/next-pwa";
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
const withPWA = withPWAInit({
dest: "public",
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
disable: process.env.NODE_ENV === "development",
workboxOptions: {
disableDevLogs: true,
runtimeCaching: [
{
urlPattern: /\/cafe\//,
handler: "StaleWhileRevalidate",
options: {
cacheName: "cafe-pages",
expiration: { maxEntries: 100, maxAgeSeconds: 7 * 24 * 60 * 60 },
},
},
{
urlPattern: /\/api\/public\//,
handler: "NetworkFirst",
options: {
cacheName: "api-cache",
networkTimeoutSeconds: 5,
expiration: { maxEntries: 200, maxAgeSeconds: 5 * 60 },
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp|ico)$/,
handler: "CacheFirst",
options: {
cacheName: "image-cache",
expiration: { maxEntries: 200, maxAgeSeconds: 30 * 24 * 60 * 60 },
},
},
],
},
});
const nextConfig: NextConfig = {
output: "standalone",
images: {
remotePatterns: [
{ protocol: "https", hostname: "**" },
{ protocol: "http", hostname: "**" },
],
},
// NOTE: the previous "short URL" redirect (/:slug → /fa/cafe/:slug) matched
// single-segment paths INCLUDING the locale itself, so "/fa" redirected to
// "/fa/cafe/fa" (and "/en" → "/fa/cafe/en") — a non-existent slug that 500'd
// the home page. Removed; re-add via middleware with explicit reserved-word
// exclusions if short café URLs are needed.
};
export default withPWA(withNextIntl(nextConfig));