https://{port}-{sandboxId}.{domain}, which expose the services you start inside it. Each way has its own option and its own token.
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, and upload or 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.
Starting with SDK version v2.0.0, secure is turned on automatically whenever a sandbox is created. Sandbox URLs stay public unless you set allowPublicTraffic 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. Requests without it, or with a wrong token, are rejected.
trafficAccessToken is undefined in JavaScript 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. Starting with novita-sandbox 2.1.2, you can move an existing sandbox 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.
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 you started are gone, so restart any service after the reset. Pass resume: false to leave the sandbox paused instead.
Disable secured access
Disablingsecure lets anyone who knows the sandbox ID run commands and read or write files in the sandbox. It is not recommended.