What's new in Content SDK 1.6
Content SDK 1.6 introduces improvements to preview security, along with important bug fixes and maintenance updates.
To update your existing Content SDK 1.5 application to 1.6:
-
In your existing application's
package.jsonfile, update every@sitecore-content-sdkpackage to version1.6.0. -
Install the dependencies with the following command:
Notable improvements and bug fixes
The following improvements and bug fixes have been introduced in Content SDK 1.6. This is not an exhaustive list. Please review the Content SDK 1.6 changelog for a complete list of all changes.
Upgrade to Next.js 15.5.14
Next.js has been upgraded from 15.5.9 to 15.5.14.
Authorize internal editing host preview requests using the PreviewMiddleware
PreviewMiddlewareWhen using Sitecore Pages to preview a site, users could open a page and preview it using the direct preview link even without the permission to access it. To overcome this, a new PreviewMiddleware is introduced that authorizes preview requests from internal editing hosts.
Currently, this is only applicable to internal editing hosts deployed on SitecoreAI.
To use this:
In middleware.ts, import PreviewMiddleware and add it as the first middleware in defineMiddleware(...):
The PreviewMiddleware is purely additive. If you do not add it, behavior is unchanged. We recommend adding it if you serve preview requests from an internal editing host.
Access preview data via request headers
Content SDK apps using Next.js App Router deployed to Vercel displayed a 500 error page in preview when Draft Mode was enabled on statically generated routes. This occurred because the searchParams parameter was empty, leaving the route without preview data and causing the editing and preview flow to fail.
This is expected behaviour in Next.js. In Draft Mode, searchParams are intentionally not forwarded. The Next.js team has confirmed that searchParams should not be relied on within draftMode(), as preview data is designed to be passed through request headers instead.
The Content SDK now propagates editing preview data from the editing render route handler to the page through a dedicated request header and exposes a new helper to access it.
To use this:
-
In your catch‑all page, find instances of
searchParamsusage: -
Replace them with the new
client.getPreviewData(...)helper to read preview data fromheaders(). as shown:ImportantFor existing apps, preview data continues to be appended to
searchParams. This does not cause the app to break on environments wheresearchParamsstill flows through. This duplication will be removed in the next major release. We recommend you to migrate to theclient.getPreviewData(...)method ahead of that.