https://{port}-{sandboxId}.{domain}, which expose the services started inside it. Each way has its own option and its own token.
Install the SDK, or the CLI for
ppio commands, and set the PPIO_API_KEY and PPIO_DOMAIN environment variables before running these examples. See Quickstart and Install and authenticate.Access modes
When
secure is false, SDK operations accept requests without a token. Anyone who knows the sandbox ID can run commands and read or write files in the sandbox. Upload and download URLs are no longer signed, so anyone who obtains one can use it. When allowPublicTraffic is true, anyone who knows the sandbox ID can open the services running in it.
Secure access is turned on automatically whenever a sandbox is created. Sandbox URLs stay public unless
allowPublicTraffic is set to false.Private sandbox URLs
Setnetwork.allowPublicTraffic to false to require a traffic access token on every request to the sandbox URLs. The API issues the token when the sandbox is created, and the SDK exposes it on the sandbox object.
Sandbox-Traffic-Access-Token header.
trafficAccessToken is undefined in Node.js and traffic_access_token is None in Python when the sandbox URLs are public.Switch an existing sandbox to secured access
secure and allowPublicTraffic are fixed while a sandbox is running. An existing sandbox can be moved to secured access in two ways: pause the sandbox and pass the new values to connect(), or call reset() on a running sandbox. Both apply the new values when the sandbox starts again.
Pause and connect
Pause the sandbox, then pass the new values toconnect(). They take effect when the sandbox resumes.
1
Pause the sandbox
2
Pass the new values to connect()
Full example
On
create(), allowPublicTraffic is nested under network. On connect() and reset(), it is a top-level option.Reset
reset() clears the sandbox memory, applies the new values, and by default starts the sandbox again right away. Processes that were started are gone, so restart any service after the reset. Pass resume: false to leave the sandbox paused instead.