Skip to content

Conversation

@shigahi
Copy link
Collaborator

@shigahi shigahi commented Jan 22, 2026

Summary

Add configurable Cache-Control headers to improve performance and reduce origin requests.

Changes

  • Add CachingOptions interface with htmlTtl, staticAssetsTtl, imageTtl
  • Add applyCacheHeaders function to set Cache-Control based on content type
  • Apply cache headers to JS, CSS, images, and HTML responses
  • Add "Cache-Control Headers" section in Advanced Settings UI

Implementation Details

Cache headers are applied based on content type:

  • Static assets (JS, CSS, fonts): public, max-age={TTL}, immutable
  • Images: public, max-age={TTL}
  • HTML pages: public, max-age={TTL}, stale-while-revalidate=60

Default TTL values:

  • HTML: 60 seconds
  • Static assets: 86400 seconds (1 day)
  • Images: 604800 seconds (1 week)

UI Changes

Added "Cache-Control Headers" section with:

  • Enable/disable toggle
  • HTML Page TTL input
  • Static Assets TTL input
  • Image TTL input

Benefits

  • Faster page loads for returning visitors
  • Reduced bandwidth costs
  • Better Lighthouse performance scores
  • Less load on Notion servers

Closes #33

- Add CachingOptions interface with htmlTtl, staticAssetsTtl, imageTtl
- Add applyCacheHeaders function to set Cache-Control based on content type
- Apply cache headers to JS, CSS, images, and HTML responses
- Add Caching section in UI with TTL configuration inputs

Closes #33
@shigahi shigahi merged commit 9397bde into master Jan 22, 2026
4 checks passed
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.

Add Cache-Control header optimization

2 participants