-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathopen-next.config.ts
More file actions
35 lines (33 loc) · 1.32 KB
/
open-next.config.ts
File metadata and controls
35 lines (33 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { defineCloudflareConfig } from "@opennextjs/cloudflare";
import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache";
import shardedTagCache from "@opennextjs/cloudflare/overrides/tag-cache/do-sharded-tag-cache";
import doQueue from "@opennextjs/cloudflare/overrides/queue/do-queue";
import queueCache from "@opennextjs/cloudflare/overrides/queue/queue-cache";
import { withRegionalCache } from "@opennextjs/cloudflare/overrides/incremental-cache/regional-cache";
const baseConfig = defineCloudflareConfig({
incrementalCache: withRegionalCache(r2IncrementalCache, { mode: "long-lived" }),
// With such a configuration, we could have up to 12 * (8 + 2) = 120 Durable Objects instances
tagCache: shardedTagCache({
baseShardSize: 12,
regionalCache: true,
regionalCacheDangerouslyPersistMissingTags: true,
shardReplication: {
numberOfSoftReplicas: 8,
numberOfHardReplicas: 2,
regionalReplication: {
defaultRegion: "enam",
},
},
}),
// `CACHE_PURGE_ZONE_ID` and `CACHE_PURGE_API_TOKEN` are required to enable cache purge
// cachePurge: purgeCache({ type: "durableObject" }),
enableCacheInterception: true,
queue: queueCache(doQueue),
});
export default {
...baseConfig,
dangerous: {
...baseConfig.dangerous,
middlewareHeadersOverrideNextConfigHeaders: true,
},
};