[Segment Cache] Support output: "export" mode (#75671)
Adds support for output: "export" mode to the Segment Cache implementation. We output an additional `.txt` data file per segment per page. When the client issues a per-segment request, it appends the segment path to the end of the page URL, rather than passing it as a request header. The segment file output follows this convention: ``` /a/b/c.html /a/b/c/__next.a.txt <- corresponds to segment /a /a/b/c/__next.a.b.txt <- corresponds to segment /a/b /a/b/c/__next.a.b.c.txt <- corresponds to segment /a/b/c ... and so on ``` This scheme is designed so that the server can implement patterns like protection rules or rewrites using just the original path. i.e. by blocking access to `/a/b`, you also block access to all of its associated segment data. Technically it's possible for the segment files to clash with a nested segment config. We add a `__next` prefix to make a clash less likely. It's unlikely this will ever be an issue in practice but if needed we could make this prefix configurable at build time.
Showing
This diff is collapsed.
Please
register
or
sign in
to comment