-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add staticResponseHeadersPolicy to NextjsProps #118
Comments
Hi @Lightbirdv, yes, you can customize the CloudFront Distrubtion's cache policies and origin request policies like this: import { Nextjs, type NextjsDistributionProps } from "cdk-nextjs-standalone";
import {
type DistributionProps,
CachePolicy,
OriginRequestPolicy,
} from "aws-cdk-lib/aws-cloudfront";
new Nextjs(this, "Nextjs", {
defaults: {
distribution: {
cachePolicies: {
imageCachePolicy: new CachePolicy(this, "ImageCachePolicy", {}),
lambdaCachePolicy: new CachePolicy(this, "LambdaCachePolicy", {}),
staticCachePolicy: new CachePolicy(this, "StaticCachePolicy", {}),
},
originRequestPolicies: {
fallbackOriginRequestPolicy: new OriginRequestPolicy(this, "FallbackOriginRequestPolicy", {}),
imageOptimizationOriginRequestPolicy: new OriginRequestPolicy(this, "ImageOptOriginRequestPolicy", {}),
lambdaOriginRequestPolicy: new OriginRequestPolicy(this, "LambdaOriginRequestPolicy", {}),
},
} satisfies Partial<NextjsDistributionProps>
}
}); Does this answer your question? |
Or are you referring to being able to customize this construct? |
Yes I am referring to the construct you linked. Since I want to customize and reuse it. I would be nice if we would be able to add the policy via the props |
@Lightbirdv, I approved the PR raised to fix this, but I'm working towards a broader solution for this problem with an overrides top level prop. I've created an RFC for it here: #132. Could you please review it and share your thoughts? Also, could you please share some sample code for how you're using |
I would like to reuse the same policy for different cloudfront distributions. It is possible for the cachePolicies and the originRequestPolicies. So could staticResponseHeadersPolicy be added to the NextjsProps to be reused?
The text was updated successfully, but these errors were encountered: