Skip to content

Strict content validation for cache-busted URLs #203

@coderabbitai

Description

@coderabbitai

This issue tracks a future enhancement to add strict validation that ensures cache-busted URLs only return content matching their embedded hash.

Context:
The current cache busting implementation in PR #192 strips the hash from incoming URLs and serves the underlying file. However, it doesn't validate that the hash in the URL matches the actual content being served. This was discussed on Slack as a potential enhancement.

Proposed Enhancement:
Add optional strict mode where:

  • The middleware validates the hash in the URL against the actual file content
  • Returns 404 or appropriate error if the hash doesn't match
  • Ensures clients never receive stale content for cache-busted URLs
  • Provides stronger guarantees about cache coherency

Trade-offs:

  • Additional overhead for hash validation on each request
  • May not be necessary for all use cases
  • Current implementation already provides good cache busting behavior

Related:

Priority:
Future enhancement - can be implemented if specific use cases require stronger guarantees.

Requested by: @nielsenko

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog 🗂️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions