sphinx-autobuild icon indicating copy to clipboard operation
sphinx-autobuild copied to clipboard

Send Cache-Control header with value no-cache

Open ffplexim opened this issue 2 months ago • 1 comments

When modifying a page that is currently not shown in the browser, we noticed that when navigating to it later browsers (especially Safari on macOS) often served the old version of the page that was seen before the update happened. Force-refreshing the page shows the correct content, but this caused confusion for some of my colleagues who didn't think of this right away.

This can simply be mitigated by returning the Cache-Control header with value no-cache (https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching#force_revalidation). This makes browsers validate whether the content is still fresh before serving the cached copy, and will ensure that no outdated content is shown when sphinx-autobuild is used.

Related: #196 (I'm not 100% sure I fully understand the problem mentioned there; but the suggested fix there is what this PR implements)

ffplexim avatar Oct 31 '25 14:10 ffplexim

I also believe that this fixes the problem described in #196.

KyeRussell avatar Nov 03 '25 04:11 KyeRussell

@AA-Turner is something else needed?

ffplexim avatar Dec 16 '25 13:12 ffplexim

Sorry, I'd missed this PR.

A

AA-Turner avatar Dec 16 '25 13:12 AA-Turner

@AA-Turner no problem, thanks a lot for reviewing and merging!

ffplexim avatar Dec 16 '25 13:12 ffplexim