Skip to content
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

[Feature] Automatic CDN invalidation for On Demand Revalidation #658

Open
conico974 opened this issue Nov 30, 2024 · 2 comments · May be fixed by #665
Open

[Feature] Automatic CDN invalidation for On Demand Revalidation #658

conico974 opened this issue Nov 30, 2024 · 2 comments · May be fixed by #665

Comments

@conico974
Copy link
Contributor

We should provide a way to automatically invalidate the CDN.

It should be a custom override and the default should be to use a dummy one that will do nothing (Cloudfront automatic CDN invalidation could incur very high cost if not done properly)

@sommeeeer
Copy link
Contributor

this is a really good idea (was thinking about this some time ago), but should we limit it somehow? as you said this can result in really high cost if poorly setup. it can also be dangerous with malicious users.

we should use asterix: /mypath* where possible. for pages router it would look like this:

if (path === "/") {
  return `/_next/data/${process.env.NEXT_BUILD_ID}/index.json`;
}
return `/_next/data/${process.env.NEXT_BUILD_ID}${path}.json*`;

i think after much try and error, without that ending asterix it would not work in some cases.

for app router its just /mypath*

@conico974
Copy link
Contributor Author

I don't think so.
The default would remain as it is, and if someone want to use it it's at their own risk.
And malicious users should never be able to trigger this unless this is explicitly allowed by the user.
As for the *, this is a cloudfront only issue/implementation.

@conico974 conico974 linked a pull request Dec 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants