Business Port Preview
About 250 wordsLess than 1 minute
Business Port Preview explains how to reach the ports your services listen on inside a Workspace.
When to use: when you started a web service in the environment and want to open it in a browser. Ports inside the environment are not reachable directly, so map or forward them with either method below first.
Method 1: WebIDE Port Mapping
Add port mappings in the PORTS panel of the WebIDE console, and the system generates the URL automatically.
There are two ways to get the business port URL:
- From the
PORTSpanel in the WebIDE console - From the environment variable
CNB_VSCODE_PROXY_URI. For example:https://xxxxxxxxxx-{{port}}.cnb.run, replace{{port}}with the actual port number
Tips
The service must be started on 0.0.0.0 to be accessible this way. Services started on localhost or 127.0.0.1 cannot use this method.
Using a business service listening on port 3000 as an example:
# 1. Start the service; it must listen on 0.0.0.0 rather than 127.0.0.1
node app.js
# 2. {{port}} in CNB_VSCODE_PROXY_URI is a port placeholder.
# Replace it with the actual port (3000); the resulting URL opens in the browser
echo "$CNB_VSCODE_PROXY_URI" | sed "s/{{port}}/3000/"Method 2: VS Code/Cursor Port Forwarding
Use the Port Forward feature of the VS Code/Cursor client to forward business ports to your local machine.