Skip to content

Commit 2cf5d3a

Browse files
authored
chore(docs): note cache-control header for preview/draft mode (#53825)
You can technically get similar ISR behavior setting the `Cache-Control` in `getServerSideProps()`, but this won't be automatically bypassed when enabling Preview Mode or Draft Mode so this PR adds that to the documentation. x-ref: [slack discussion](https://vercel.slack.com/archives/C03S8ED1DKM/p1691514209722429)
1 parent 1286e14 commit 2cf5d3a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/03-pages/01-building-your-application/06-configuring/11-draft-mode.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ Then, send a request to `/api/disable-draft` to invoke the API Route. If calling
156156

157157
### Works with `getServerSideProps`
158158

159-
Draft Mode works with `getServerSideProps` as well. It will also be available on the `context` object containing `draftMode`
159+
Draft Mode works with `getServerSideProps`, and is available as a `draftMode` key in the [`context`](/docs/pages/api-reference/functions/get-server-side-props#context-parameter) object.
160+
161+
> **Good to know**: You shouldn't set the `Cache-Control` header when using Draft Mode because it cannot be bypassed. Instead, we recommend using [ISR](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration).
160162
161163
### Works with API Routes
162164

docs/03-pages/01-building-your-application/06-configuring/14-preview-mode.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ You can pass an object to `setPreviewData` and have it be available in `getStati
219219

220220
The preview mode works on `getServerSideProps` as well. It will also be available on the `context` object containing `preview` and `previewData`.
221221

222+
> **Good to know**: You shouldn't set the `Cache-Control` header when using Preview Mode because it cannot be bypassed. Instead, we recommend using [ISR](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration).
223+
222224
### Works with API Routes
223225

224226
API Routes will have access to `preview` and `previewData` under the request object. For example:

0 commit comments

Comments
 (0)