Skip to content

[Feature Request]: Support All Cache-Control Directives #263

@samuel871211

Description

@samuel871211

Current Status

Currently, this package only supports a limited set of Cache-Control directives:

  • public
  • max-age
  • immutable

Proposal

Add support for additional Cache-Control directives as defined in the IANA HTTP Cache Directive Registry (https://www.iana.org/assignments/http-cache-directives/http-cache-directives.xhtml).

Relevant Standards

  • RFC 9111 - HTTP Caching (core directives)
  • RFC 8246 - HTTP Immutable Responses (for immutable directive)
  • RFC 5861 - HTTP Cache-Control Extensions for Stale Content (for stale-while-revalidate, stale-if-error)

Suggested Additional Directives

High-priority directives commonly used in static file serving:

  • private
  • no-cache
  • no-store
  • must-revalidate
  • proxy-revalidate
  • s-maxage
  • stale-while-revalidate
  • stale-if-error
  • no-transform
  • must-understand

Benefits

  1. More comprehensive caching control for static assets
  2. Better alignment with HTTP standards
  3. Improved developer experience with complete Cache-Control support

Implementation Considerations

  • Maintain backward compatibility with existing API
  • Add proper validation for directive combinations
  • Consider performance impact of additional option parsing

Would you be interested in this enhancement? I'm happy to contribute to the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions