Skip to main content
Start a service inside a sandbox and call sandbox.get_url(port) to get the exact signed preview URL to share. Keep the sandbox and the server process running while someone is using the URL.
from nullspace import Sandbox

with Sandbox.create(template="base") as sandbox:
    server = sandbox.commands.run(
        "cd /workspace && python3 -m http.server 8080",
        shell=True,
        background=True,
    )
    try:
        print(sandbox.get_url(8080))
        input("Open the URL, then press Enter to stop the server and destroy the sandbox...")
    finally:
        server.kill()
Private beta preview URLs use the temporary API hostname path:
https://api.your-nullspace-domain/__ns-edge/sandboxes/<sandbox-id>/ports/<port>/?edge_token=...
Older wildcard-style sandbox hostnames are still supported where dedicated wildcard TLS is configured, but the private beta path stays on the already trusted API certificate.

HTTP and WebSocket URLs

http_url = sandbox.get_url(8080)
websocket_url = sandbox.get_websocket_url(8080)
print(http_url)
print(websocket_url)
Use the exact signed URL returned by the SDK. If the deployment returns an edge_token query parameter, do not strip or rewrite it. After opening a signed HTTP preview URL in a browser, normal page navigation can continue through the scoped preview continuation cookie. WebSocket clients should use the returned websocket_url; HTTP continuation cookies do not authorize WebSocket upgrades. Use a custom preview proxy when you need your own domain, app session checks, or proxy middleware. Concept: Create. API reference: getHost, createSandbox, and execCommand.