Kraftvaerk.Umbraco.Headless.Preview 1.2.0

dotnet add package Kraftvaerk.Umbraco.Headless.Preview --version 1.2.0
                    
NuGet\Install-Package Kraftvaerk.Umbraco.Headless.Preview -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kraftvaerk.Umbraco.Headless.Preview" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kraftvaerk.Umbraco.Headless.Preview" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Kraftvaerk.Umbraco.Headless.Preview" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kraftvaerk.Umbraco.Headless.Preview --version 1.2.0
                    
#r "nuget: Kraftvaerk.Umbraco.Headless.Preview, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kraftvaerk.Umbraco.Headless.Preview@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kraftvaerk.Umbraco.Headless.Preview&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Kraftvaerk.Umbraco.Headless.Preview&version=1.2.0
                    
Install as a Cake Tool

Kraftvaerk.Umbraco.Headless.Preview

Preview support for headless Umbraco projects.
This package replaces Umbraco's built-in preview (/umbraco/preview) with a secure iframe that points to your configured frontend application.


How it works

  1. When an editor clicks Preview in Umbraco, this package renders an iframe instead of the standard MVC page.
    The iframe URL is built from configuration:

    _previewPath = configuration.GetValue<string>("HeadlessPreview:Url") ?? string.Empty;
    var url = $"{_previewPath}?id={contentKey}&secret={secret}&uid={backofficeUserId}&rand={Guid.NewGuid()}";
    
    • id = Umbraco content key
    • secret = short-lived handshake token
    • uid = current backoffice user id
    • rand = random Guid to defeat caching
  2. Your frontend app should read the query parameters and call back to Umbraco:

    GET /api/custompreviewapi/check?key={secret}&id={uid}
    
  3. If the secret is valid, the API responds 200 OK with a new long-lived preview Guid.
    Your frontend app should store this Guid (e.g. in a cookie).

  4. When requesting content from the Delivery API in preview mode, your frontend app should send:

    GET /umbraco/delivery/api/v1/content/item/{id}
    Api-Key: <your-delivery-key>
    Preview: true
    X-UMB-PREVIEW: <guid-from-check>
    
  5. On the Umbraco side, the package extends IRequestMemberAccessService to allow access when the provided Guid matches what is stored in memory.


Configuration

Add to appsettings.json:

{
  "HeadlessPreview": {
      "Url": "http://localhost:5173/preview"
  }
}
  • Url: the entrypoint of your frontend preview app.

Example frontend (Node + Vite)

A minimal runnable example frontend is included in example-frontend.

cd example-frontend
npm install
npm run dev

Defaults:

  • Frontend URL: http://localhost:5173/preview
  • Umbraco target: http://localhost:6783 (configurable in example-frontend/.env.example)
  • Delivery API key: local-preview-api-key

Features

  • Overrides /umbraco/preview with an iframe preview experience
  • Secure handshake between Umbraco and your frontend app
  • One-time secret + time-limited preview token
  • Integrates seamlessly with the Umbraco Delivery API

Security

  • Secrets are short-lived and tied to the initiating backoffice user.
  • Preview tokens automatically expire after a limited TTL.
  • All access is validated server-side before unpublished content is returned.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 366 6/23/2026
1.1.2 814 11/27/2025
1.1.1 230 11/26/2025
1.1.0 231 10/15/2025
1.0.2 238 9/23/2025
1.0.1 315 9/15/2025
1.0.0 329 9/15/2025