wellcomecollection / wellcomecollection.org

🪟 Wellcome Collection's website and services that support it
https://wellcomecollection.org
MIT License
39 stars 5 forks source link

Don't send no-cache headers from our apps #9697

Closed alexwlchan closed 6 months ago

alexwlchan commented 1 year ago

Currently our apps send aggressive "don't cache anything ever" headers:

$ curl -v 'https://wellcomecollection.org' 2>&1 | grep cache
< cache-control: private, no-cache, no-store, max-age=0, must-revalidate
< x-cache: Miss from cloudfront

This header means that every request is being sent to our apps, even when it's similar to another request that's come in recently. This has several drawbacks:

We saw this today when the Wellcome Collection "What's On" newsletter went out. It landed in everyone's inboxes, and something like 500 email servers proceeded to scan every link in the newsletter, which knocked the site over. Because these requests were distributed over many different IP addresses, our WAF rules didn't protect us. But they scanned a relatively small number of different URLs – a caching period would have probably protected us from this spike.

This is a topic that's been discussed on multiple occasions previously:

gestchild commented 6 months ago

Closing this as work was carried out in:

https://github.com/wellcomecollection/wellcomecollection.org/pull/9832

https://github.com/wellcomecollection/wellcomecollection.org/pull/9932