Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When looking at the server statistics, there is a disproportionate amount of 304 responses being served by the Hedy website. The reason is that since migrating to Flask 2.0, the defaults for caching changed. In Flask 1.x, static file caching was enabled by default, in Flask 2.x it no longer is. For the CDN, we still up the caching lifetime to a day, but the caching directive still contains `no-cache`, which leads to a confusing HTTP response header: ``` $ curl -vv https://hedycode.com/static-c845eac78bba21798d23a3ea3134639ad0194d35/css/additional.css -o /dev/null ... < Cache-Control: no-cache, max-age=86400 ... ``` This response says: "don't cache me, but you can do that for up to a day". The upshot is that our CDN doesn't cache, hits the upstream server every time, and gets served a `304 Not Modified` response. As a fix, enable caching by default so Flask doesn't set `no-cache`, and also make sure to remove the `no_cache` setting in the CDN handler.
- Loading branch information