Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Nov 11, 2025

This PR intended to fix browser cache related problems when using docfx serve command.

Background
Currently docfx serve command using default UseStaticFiles setting.
So Cache-Control header is not written. And browser's default heuristic caching policy is used.

When using docfx serve command, sometimes cached contents are shown.
And it need to force refresh cache with Ctrl+F5 or Disable Cache on Developer Tools.

What's changed in this PR
cache-control: max-age=60 is added on response header.
When max-age is expired. Browser request content to server with ETag.

If there is no changes. 304 Not Modified response is returned.
Therefore, the load on the Kestrel side is not expected to be significant when using cache-control: max-age=60 setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant