fix: purge CDN cache when article is published #2896
+1,085
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
https://github.com/mitodl/hq/issues/9934
Description (What does it do?)
Fastly caches Next.js server rendered pages for 30 minutes, instructed by headers in the Next.js config.
As a result, when articles are published, the previous version is still served until the TTL expires.
This is perhaps acceptable for readers, unless there is some error in the article that needs to be updated quickly. It is however disorienting for editors, who expect to see their changes made live on publish.
We need to purge the CDN entry for the article detail URLs.
Screenshots (if appropriate):
How can this be tested?
We can not test it locally because of host issue that happens when we hit the Fastly api from dev env so we need to test it on RC. I have added the logs which we can see on RC and its implementation is completed
Additional Context