sst 2.10.1 → 2.10.2

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.
@@ -267,6 +267,7 @@ export class NextjsSite extends SsrSite {
267
267
  });
268
268
  }
269
269
  buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy) {
270
+ const { cdk } = this.props;
270
271
  return {
271
272
  viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
272
273
  functionAssociations: this.buildBehaviorFunctionAssociations(),
@@ -275,10 +276,12 @@ export class NextjsSite extends SsrSite {
275
276
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
276
277
  compress: true,
277
278
  cachePolicy,
279
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
278
280
  originRequestPolicy,
279
281
  };
280
282
  }
281
283
  buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy) {
284
+ const { cdk } = this.props;
282
285
  return {
283
286
  viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
284
287
  functionAssociations: this.buildBehaviorFunctionAssociations(),
@@ -287,6 +290,7 @@ export class NextjsSite extends SsrSite {
287
290
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
288
291
  compress: true,
289
292
  cachePolicy,
293
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
290
294
  originRequestPolicy,
291
295
  edgeLambdas: [
292
296
  {
@@ -298,6 +302,7 @@ export class NextjsSite extends SsrSite {
298
302
  };
299
303
  }
300
304
  buildImageBehavior(cachePolicy) {
305
+ const { cdk } = this.props;
301
306
  const imageFn = this.createImageOptimizationFunction();
302
307
  const imageFnUrl = imageFn.addFunctionUrl({
303
308
  authType: FunctionUrlAuthType.NONE,
@@ -309,9 +314,11 @@ export class NextjsSite extends SsrSite {
309
314
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
310
315
  compress: true,
311
316
  cachePolicy,
317
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
312
318
  };
313
319
  }
314
320
  buildStaticFileBehavior(s3Origin) {
321
+ const { cdk } = this.props;
315
322
  return {
316
323
  origin: s3Origin,
317
324
  viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
@@ -319,6 +326,7 @@ export class NextjsSite extends SsrSite {
319
326
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
320
327
  compress: true,
321
328
  cachePolicy: CachePolicy.CACHING_OPTIMIZED,
329
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
322
330
  };
323
331
  }
324
332
  buildDefaultNextjsBehaviorForRegional(serverOrigin, s3Origin, cachePolicy, originRequestPolicy) {
@@ -339,6 +347,7 @@ export class NextjsSite extends SsrSite {
339
347
  functionAssociations: this.buildBehaviorFunctionAssociations(),
340
348
  compress: true,
341
349
  cachePolicy,
350
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
342
351
  originRequestPolicy,
343
352
  ...(cfDistributionProps.defaultBehavior || {}),
344
353
  };
@@ -354,6 +363,7 @@ export class NextjsSite extends SsrSite {
354
363
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
355
364
  compress: true,
356
365
  cachePolicy,
366
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
357
367
  originRequestPolicy,
358
368
  ...(cfDistributionProps.defaultBehavior || {}),
359
369
  edgeLambdas: [
@@ -2,7 +2,7 @@ import { Construct } from "constructs";
2
2
  import { Bucket, BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
3
3
  import { Function as CdkFunction, FunctionProps } from "aws-cdk-lib/aws-lambda";
4
4
  import { IHostedZone } from "aws-cdk-lib/aws-route53";
5
- import { Distribution, ICachePolicy, BehaviorOptions, CachePolicy, Function as CfFunction, FunctionEventType as CfFunctionEventType } from "aws-cdk-lib/aws-cloudfront";
5
+ import { Distribution, ICachePolicy, IResponseHeadersPolicy, BehaviorOptions, CachePolicy, Function as CfFunction, FunctionEventType as CfFunctionEventType } from "aws-cdk-lib/aws-cloudfront";
6
6
  import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
7
7
  import { SSTConstruct } from "./Construct.js";
8
8
  import { NodeJSProps } from "./Function.js";
@@ -183,6 +183,11 @@ export interface SsrSiteProps {
183
183
  * is one that performs no caching of the server response.
184
184
  */
185
185
  serverCachePolicy?: ICachePolicy;
186
+ /**
187
+ * Override the CloudFront response headers policy properties for responses
188
+ * from the server rendering Lambda.
189
+ */
190
+ responseHeadersPolicy?: IResponseHeadersPolicy;
186
191
  server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture">;
187
192
  };
188
193
  }
@@ -547,6 +547,7 @@ function handler(event) {
547
547
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
548
548
  compress: true,
549
549
  cachePolicy: cdk?.serverCachePolicy ?? this.buildServerCachePolicy(),
550
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
550
551
  originRequestPolicy: this.buildServerOriginRequestPolicy(),
551
552
  ...(cfDistributionProps.defaultBehavior || {}),
552
553
  functionAssociations: [
@@ -565,6 +566,7 @@ function handler(event) {
565
566
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
566
567
  compress: true,
567
568
  cachePolicy: cdk?.serverCachePolicy ?? this.buildServerCachePolicy(),
569
+ responseHeadersPolicy: cdk?.responseHeadersPolicy,
568
570
  originRequestPolicy: this.buildServerOriginRequestPolicy(),
569
571
  ...(cfDistributionProps.defaultBehavior || {}),
570
572
  functionAssociations: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.10.1",
4
+ "version": "2.10.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },