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:

RequestResponse
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:

Option

Description

--site <site>

Required.

The target Sitecore environment site.

--port <port>

The local port for tunneling.

Default: 3000

c, --config <config>

The path to the root sitecore.json directory.

Default: current working directory

-n, --environment-name

Named Sitecore environment to use.

Default: default.

-t, --trace

Report additional diagnostic and performance data.

Default: False

-v, --verbose

Report 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.

RequestResponse
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.

Do you have some feedback for us?

If you have suggestions for improving this article,