Skip to main content
Preview URLs give a sandbox port a publicly accessible HTTPS hostname. This lets you share a running web server, API, or any TCP service without any networking configuration.

Create a Preview URL

oc preview create sb-abc123 --port 3000
With a custom domain:
oc preview create sb-abc123 --port 8080 --domain preview.example.com

oc preview create <sandbox-id>

Provisions a public HTTPS URL that proxies traffic to the specified port inside the sandbox.
FlagTypeDefaultDescription
--portintSandbox port to expose (required)
--domainstringCustom hostname to use instead of the generated one
Output:
Preview URL created:
  Hostname:   sb-abc123-3000.preview.opencomputer.dev
  Port:       3000
  SSL:        active

List Preview URLs

oc preview list sb-abc123

oc preview list <sandbox-id>

Shows all active preview URLs for a sandbox. Output:
PORT  HOSTNAME                                    SSL     CREATED
3000  sb-abc123-3000.preview.opencomputer.dev     active  2024-01-15T10:30:00Z
8080  preview.example.com                         active  2024-01-15T10:31:00Z

Delete a Preview URL

oc preview delete sb-abc123 3000

oc preview delete <sandbox-id> <port>

Removes the preview URL for the given port. The sandbox keeps running; only the public URL is torn down.

Examples

Share a Dev Server

# Start a web server inside the sandbox
oc exec sb-abc123 -- bash -c 'cd /app && npm run dev &'

# Expose port 3000
oc preview create sb-abc123 --port 3000

# Share the URL with a teammate
oc preview list sb-abc123 --json | jq -r '.[0].hostname'

Expose Multiple Ports

# Frontend on 3000, API on 4000
oc preview create sb-abc123 --port 3000
oc preview create sb-abc123 --port 4000

oc preview list sb-abc123

Use a Custom Domain

oc preview create sb-abc123 --port 8080 --domain staging.myapp.com
Custom domains require DNS to point to the OpenComputer ingress and may take a few minutes for SSL to become active.

Scripted: Create and Print URL

URL=$(oc preview create sb-abc123 --port 3000 --json | jq -r '.hostname')
echo "Open: https://$URL"