Does anybody have any thoughts on this?
Dec 14, 2023
3
Level 1
What is a best(or recommended) cach policy for CloudFront
I have a question about deploying Laravel on AWS behind CloudFront.
Basically, I deploy Laravel on AWS like CloudFront -> ALB -> Fargate. In that case, as far as I'm concerned, in order to keep users's session safe, we need to set CachePolicy on CloudFront.
Below is my CloudFormation code to build such CachePolicy, but not too sure if its a right setting. So could you tell me about a best practice or recommended CachePolicy for this?
CachePolicyApp:
Type: AWS::CloudFront::CachePolicy
Properties:
CachePolicyConfig:
Name: myCachePolicy
Comment: myCachePolicy
DefaultTTL: 86400
MaxTTL: 31536000
MinTTL: 1
ParametersInCacheKeyAndForwardedToOrigin:
EnableAcceptEncodingBrotli: true
EnableAcceptEncodingGzip: true
HeadersConfig:
HeaderBehavior: whitelist
Headers:
- Origin
- Authorization
- Host
- CloudFront-Forwarded-Proto
CookiesConfig:
CookieBehavior: whitelist
Cookies:
- laravel_session
QueryStringsConfig:
QueryStringBehavior: none
Please or to participate in this conversation.