Skip to content

feat(perf): If-Modified-Since → 304 handling for Last-Modified routes #422

Description

@julianken

Follow-up to #418. Now that Last-Modified is emitted, implement the conditional-request handling: when proxy.ts receives a request with If-Modified-Since header, compare to Payload doc's updatedAt and return HTTP 304 (no body) when not modified.

Implementation requires an extra cheap Payload lookup in proxy.ts (the same field-projected updatedAt query the #418 proxy already does for the response-header path, but called before NextResponse.next() to gate the request). For listing routes the comparison is against the ISR-snapshot floor captured in proxy.ts.

Why this is non-trivial:

Acceptance criteria:

  • proxy.ts compares If-Modified-Since to the same updatedAt source used for the 200 path
  • Returns HTTP 304 (no body, full headers) when the doc has not been modified
  • Tests: unit (mock both header presence and updatedAt) + E2E (curl with -H 'If-Modified-Since: ')

Closes the bandwidth-savings half of the original Last-Modified work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:seoSEO + AI-discovery strategy workenhancementNew feature or requeststatus:todoReady to start

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions