carlin 2.2.0 → 2.2.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.
- package/dist/index.mjs +24 -9
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3526,7 +3526,9 @@ const getResponseHeadersPolicyConfig = ({ responseHeaders }) => {
|
|
|
3526
3526
|
}
|
|
3527
3527
|
return {
|
|
3528
3528
|
Comment: { "Fn::Sub": ["Response headers policy for ${Project} project.", { Project: { Ref: "Project" } }] },
|
|
3529
|
-
|
|
3529
|
+
...responseHeaders.some(({ header }) => {
|
|
3530
|
+
return header.toLowerCase() === "vary";
|
|
3531
|
+
}) ? {} : { CorsConfig: BASELINE_RESPONSE_HEADERS_CONFIG.CorsConfig },
|
|
3530
3532
|
CustomHeadersConfig: { Items: responseHeaders.map(({ header, value, override }) => {
|
|
3531
3533
|
return {
|
|
3532
3534
|
Header: header,
|
|
@@ -3623,6 +3625,22 @@ const CLOUDFRONT_VIEWER_REQUEST_FUNCTION_LOGICAL_ID = "ViewerRequestFunction";
|
|
|
3623
3625
|
const ROUTE_53_RECORD_SET_GROUP_LOGICAL_ID = "Route53RecordSetGroup";
|
|
3624
3626
|
const ERROR_DOCUMENT = "404/index.html";
|
|
3625
3627
|
/**
|
|
3628
|
+
* CORS of the bucket the distribution serves from.
|
|
3629
|
+
*
|
|
3630
|
+
* The origin is what answers CORS whenever the response headers policy has no
|
|
3631
|
+
* `CorsConfig` — which is the case when the `responseHeaders` option defines
|
|
3632
|
+
* `vary`, since CloudFront's CORS handling owns `Vary`. `AllowedMethods` is
|
|
3633
|
+
* limited to what the bucket can serve; advertising the write methods of the
|
|
3634
|
+
* managed policy would be fiction.
|
|
3635
|
+
*/
|
|
3636
|
+
const BUCKET_CORS_CONFIGURATION = { CorsRules: [{
|
|
3637
|
+
AllowedHeaders: ["*"],
|
|
3638
|
+
AllowedMethods: ["GET", "HEAD"],
|
|
3639
|
+
AllowedOrigins: ["*"],
|
|
3640
|
+
Id: "OpenCors",
|
|
3641
|
+
MaxAge: 600
|
|
3642
|
+
}] };
|
|
3643
|
+
/**
|
|
3626
3644
|
* Name: Managed-CachingDisabled
|
|
3627
3645
|
* ID: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
|
|
3628
3646
|
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html
|
|
@@ -3670,13 +3688,7 @@ const getBucketStaticWebsiteTemplate = ({ spa }) => {
|
|
|
3670
3688
|
[STATIC_APP_BUCKET_LOGICAL_ID]: {
|
|
3671
3689
|
Type: "AWS::S3::Bucket",
|
|
3672
3690
|
Properties: {
|
|
3673
|
-
CorsConfiguration:
|
|
3674
|
-
AllowedHeaders: ["*"],
|
|
3675
|
-
AllowedMethods: ["GET"],
|
|
3676
|
-
AllowedOrigins: ["*"],
|
|
3677
|
-
Id: "OpenCors",
|
|
3678
|
-
MaxAge: 600
|
|
3679
|
-
}] },
|
|
3691
|
+
CorsConfiguration: BUCKET_CORS_CONFIGURATION,
|
|
3680
3692
|
PublicAccessBlockConfiguration: { BlockPublicPolicy: false },
|
|
3681
3693
|
WebsiteConfiguration: {
|
|
3682
3694
|
IndexDocument: `index.html`,
|
|
@@ -3713,7 +3725,10 @@ const getCloudFrontTemplate = ({ acm, aliases = [], appendIndexHtml, responseHea
|
|
|
3713
3725
|
Resources: {
|
|
3714
3726
|
[STATIC_APP_BUCKET_LOGICAL_ID]: {
|
|
3715
3727
|
Type: "AWS::S3::Bucket",
|
|
3716
|
-
Properties: {
|
|
3728
|
+
Properties: {
|
|
3729
|
+
CorsConfiguration: BUCKET_CORS_CONFIGURATION,
|
|
3730
|
+
PublicAccessBlockConfiguration: { BlockPublicPolicy: false }
|
|
3731
|
+
}
|
|
3717
3732
|
},
|
|
3718
3733
|
[`${STATIC_APP_BUCKET_LOGICAL_ID}S3BucketPolicy`]: {
|
|
3719
3734
|
Type: "AWS::S3::BucketPolicy",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carlin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://ttoss.dev/docs/carlin/",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"ts-node": "^10.9.2",
|
|
58
58
|
"uglify-js": "^3.19.3",
|
|
59
59
|
"yargs": "^17.7.2",
|
|
60
|
-
"@ttoss/config": "^1.37.17",
|
|
61
60
|
"@ttoss/cloudformation": "^0.13.11",
|
|
61
|
+
"@ttoss/config": "^1.37.17",
|
|
62
62
|
"@ttoss/read-config-file": "^2.2.20"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|