Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

I want to add to the array instead of overwriting it with extensions. #392

Open
kenkubomi opened this issue May 23, 2024 · 2 comments
Open

Comments

@kenkubomi
Copy link

Is it possible to add my own origins and cache behaviors to the CloudFront distribution generated by the plugin?
I tried adding it with extensions, but the existing array was overwritten.

constructs:
  website:
    type: server-side-website
    extensions:
      distribution:
        Properties:
          DistributionConfig:
            CacheBehaviors:
              - TargetOriginId: !GetAtt FilesBucket.RegionalDomainName
                PathPattern: /files/*
                ViewerProtocolPolicy: redirect-to-https
                CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
                TrustedKeyGroups:
                 - s3-for-presigned-url-group
            Origins:
              - DomainName: !GetAtt FilesBucket.RegionalDomainName
                Id: !GetAtt FilesBucket.RegionalDomainName
                OriginAccessControlId: !GetAtt CloudFrontOriginAccessControl.Id
                S3OriginConfig:
                  OriginAccessIdentity: ''
@kenkubomi
Copy link
Author

What I want to do is very simple.

Added to the Server-side website,
I would like to set my own domain to the S3 pre-signed URL via CloudFront.

@kevincerro
Copy link
Contributor

kevincerro commented Dec 8, 2024

I have the same issue, the lift behaviors are overwirtten.
My goal is to add new behaviours to cache some patterns

Captura de pantalla 2024-12-08 a las 14 00 02

constructs:
    website:
        type: server-side-website
        domain: ${param:domains}
        redirectToMainDomain: true
        certificate: 'arn:aws:acm:us-east-1:267434568533:certificate/6ef9ee04-6c8a-4363-bdb8-91e34da5d2b7'
        originName: web
        assets:
            '/assets/*': public/assets
            '/bundles/*': public/bundles
            '/robots.txt': public/robots.txt
        extensions:
            distribution:
                Properties:
                    DistributionConfig:
                        PriceClass: PriceClass_100
                        CacheBehaviors:
                            -   PathPattern: "/"
                                TargetOriginId: originId
                                ForwardedValues:
                                    QueryString: false
                                    Cookies:
                                        Forward: none
                                ViewerProtocolPolicy: redirect-to-https
                                MinTTL: 0
                                DefaultTTL: 60 # 1 day
                                MaxTTL: 60 # 1 year
                                Compress: true

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants