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.
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:
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 |
|---|---|
|
|
Required. The target Sitecore environment site. |
|
|
The local port for tunneling. Default: 3000 |
|
|
The path to the root Default: current working directory |
|
|
Named Sitecore environment to use. Default: |
|
|
Report additional diagnostic and performance data. Default: |
|
|
Report additional diagnostic and performance data. Default: |
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.
dotnet sitecore tunnel create --site Site1 --port 3001When 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.