sst 2.8.1 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -153,7 +153,13 @@ export class NextjsSite extends SsrSite {
153
153
  authType: FunctionUrlAuthType.NONE,
154
154
  });
155
155
  const serverOrigin = new HttpOrigin(Fn.parseDomainName(serverFnUrl.url));
156
- const cachePolicy = cdk?.serverCachePolicy ?? this.buildServerCachePolicy();
156
+ const cachePolicy = cdk?.serverCachePolicy ??
157
+ this.buildServerCachePolicy([
158
+ "accept",
159
+ "rsc",
160
+ "next-router-prefetch",
161
+ "next-router-state-tree",
162
+ ]);
157
163
  const originRequestPolicy = this.buildServerOriginRequestPolicy();
158
164
  const serverBehavior = this.buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy);
159
165
  return new Distribution(this, "Distribution", {
@@ -178,7 +184,13 @@ export class NextjsSite extends SsrSite {
178
184
  const { cdk } = this.props;
179
185
  const cfDistributionProps = cdk?.distribution || {};
180
186
  const s3Origin = new S3Origin(this.cdk.bucket);
181
- const cachePolicy = cdk?.serverCachePolicy ?? this.buildServerCachePolicy();
187
+ const cachePolicy = cdk?.serverCachePolicy ??
188
+ this.buildServerCachePolicy([
189
+ "accept",
190
+ "rsc",
191
+ "next-router-prefetch",
192
+ "next-router-state-tree",
193
+ ]);
182
194
  const originRequestPolicy = this.buildServerOriginRequestPolicy();
183
195
  const functionVersion = this.serverLambdaForEdge.currentVersion;
184
196
  const serverBehavior = this.buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy);
@@ -276,7 +276,7 @@ export declare class SsrSite extends Construct implements SSTConstruct {
276
276
  function: CfFunction;
277
277
  }[];
278
278
  private buildStaticFileBehaviors;
279
- protected buildServerCachePolicy(): CachePolicy;
279
+ protected buildServerCachePolicy(allowedHeaders?: string[]): CachePolicy;
280
280
  protected buildServerOriginRequestPolicy(): import("aws-cdk-lib/aws-cloudfront").IOriginRequestPolicy;
281
281
  private createCloudFrontInvalidation;
282
282
  protected validateCustomDomainSettings(): void;
@@ -436,7 +436,7 @@ export class SsrSite extends Construct {
436
436
  });
437
437
  const ssrFn = new SsrFunction(this, `ServerFunction`, {
438
438
  description: "Server handler placeholder",
439
- bundle: path.join(__dirname, "../../support/ssr-site-function-stub"),
439
+ bundle: path.join(__dirname, "../support/ssr-site-function-stub"),
440
440
  handler: "index.handler",
441
441
  runtime,
442
442
  memorySize,
@@ -608,10 +608,12 @@ function handler(event) {
608
608
  }
609
609
  return staticsBehaviours;
610
610
  }
611
- buildServerCachePolicy() {
611
+ buildServerCachePolicy(allowedHeaders) {
612
612
  return new CachePolicy(this, "ServerCache", {
613
613
  queryStringBehavior: CacheQueryStringBehavior.all(),
614
- headerBehavior: CacheHeaderBehavior.none(),
614
+ headerBehavior: allowedHeaders && allowedHeaders.length > 0
615
+ ? CacheHeaderBehavior.allowList(...allowedHeaders)
616
+ : CacheHeaderBehavior.none(),
615
617
  cookieBehavior: CacheCookieBehavior.all(),
616
618
  defaultTtl: CdkDuration.days(0),
617
619
  maxTtl: CdkDuration.days(365),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.8.1",
4
+ "version": "2.8.3",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },