elastic / elastic/docs

Set max age of cache

Open
#2,509 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
265
Forks
347
Avg merge
3d 15h
Merged PRs (30d)
2

Description

### Summary

We don't set a max age for cached website assets. This is problematic for certain updates, like https://github.com/elastic/docs/pull/2478, that change the appearance or functionality of the docs. After the update, many users reported a weird half-new/half-old version of the site that could only be fixed with a hard refresh of the page.

One solution would be to use the `Cache-Control` [`max age`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) directive. The example below tells the browser that it can use a cached file for one week without having to revalidate it. After one week, the browser will revalidate the file and download a new file if it exists.

```
Cache-Control: max-age=604800
```

I'm new to this topic so if I'm wrong, let me know :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.