1. Sitecore CLI command reference

The tunnel command

The Tunneling plugin for the Sitecore CLI includes a tunnel command. This command creates Ngrok tunnel connection for your headless application running locally, and registers it as the editing host for a website that is running in an SitecoreAI environment.

Note

If you are using JSS v. 22.1 or higher, and connect to visual editors using the metadata method, you don't need to configure tunneling.

Usage

You can use the command as follows:

shell
dotnet sitecore tunnel [subcommand] [options]

Subcommand

You can use the following subcommand:

  • create - creates a tunnel for a SitecoreAI environment

Options

You can use the following options with theĀ create command:

OptionDescription
--site Required.The target Sitecore environment site.
--port The local port for tunneling.Default: 3000
c, --config The path to the root sitecore.json directory.Default: current working directory
-n, --environment-nameNamed Sitecore environment to use.Default: default.
-t, --traceReport additional diagnostic and performance data.Default: False
-v, --verboseReport additional diagnostic and performance data.Default: False

Example

To use the tunnel command, you must provide values for the --site option. The --port option is not required, but the following example uses port 3001.

shell
dotnet sitecore tunnel create --site Site1 --port 3001

When successful, the command registers the locally running headless rendering host (http://localhost:3001) as a default rendering host for site Site1 running in a environment. It creates a new RenderingHost item in the /sitecore/system/Settings/Services/Rendering Hosts folder with the public NGrok tunnel address, and updates the settings of the specified website to use that new rendering host definition.

If you have suggestions for improving this article, let us know!