Files
next.js/test/e2e/app-dir/segment-cache/export/app/page.tsx
Andrew ClarkandGitHub db0a723db9 [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.
2025-02-28 12:46:48 -05:00

40 lines
959 B
TypeScript

import { LinkAccordion } from '../components/link-accordion'
export default function OutputExport() {
return (
<>
<p>
Demonstrates that per-segment prefetching works in{' '}
<code>output: export</code> mode.
</p>
<ul>
<li>
<LinkAccordion href="/target-page">Target</LinkAccordion>
</li>
</ul>
<p>
The following link is rewritten on the server to the same page as the
link above:
</p>
<ul>
<li>
<LinkAccordion href="/rewrite-to-target-page">
Rewrite to target page
</LinkAccordion>
</li>
</ul>
<p>
The following link is redirected on the server to the same page as the
link above:
</p>
<ul>
<li>
<LinkAccordion href="/redirect-to-target-page">
Redirect to target page
</LinkAccordion>
</li>
</ul>
</>
)
}