Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sst/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smooai/deploy",
"version": "0.1.5",
"version": "0.1.6",
"description": "Shared SmooAI deploy primitives — reusable SST v4 constructs (API Gateway WebSocket + Rust Lambda + DynamoDB single-table + S3 blob bucket + S3 Vectors placeholder). Consumed by smooth-operator and dogfooded by smooai.",
"license": "MIT",
"type": "module",
Expand Down
12 changes: 11 additions & 1 deletion sst/src/components/smooai-next-edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,24 @@ export class SmooaiNextEdge {
// year-long s-maxage at the edge. Cache key includes all cookies/qs so
// authenticated pages get their own (effectively uncached, per-session)
// entries rather than serving one user's HTML to another.
//
// CRITICAL for Next.js App Router: the cache key MUST include the RSC
// request headers. Next serves the SAME URL as both the HTML document
// (no `RSC` header) and the React Server Component / Flight payload
// (`RSC: 1`, prefetch, router-state-tree, next-url). With these NOT in
// the cache key the two responses collide — a cached RSC/Flight payload
// gets served for a document request, so the page renders as raw text
// (`1:"$Sreact.fragment"…`) and the app never hydrates (forms dead,
// sign-in "does nothing"). Whitelisting them gives the document and each
// RSC variant distinct cache entries. (Matches OpenNext / sst.aws.Nextjs.)
const htmlPolicy = new aws.cloudfront.CachePolicy(`${name}HtmlPolicy`, {
name: $interpolate`${$app.name}-${$app.stage}-${name}-html`,
defaultTtl: htmlDefaultTtl,
maxTtl: htmlMaxTtl,
minTtl: 0,
parametersInCacheKeyAndForwardedToOrigin: {
cookiesConfig: { cookieBehavior: 'all' },
headersConfig: { headerBehavior: 'none' },
headersConfig: { headerBehavior: 'whitelist', headers: { items: ['RSC', 'Next-Router-Prefetch', 'Next-Router-State-Tree', 'Next-Url'] } },
queryStringsConfig: { queryStringBehavior: 'all' },
enableAcceptEncodingGzip: true,
enableAcceptEncodingBrotli: true,
Expand Down
Loading