Allow Preflight Requests on Port
set_port_preflightAllow or block CORS preflight OPTIONS requests on a locked port so cross-origin browser pages can reach the app while all other requests still need a key.
Instructions
Let CORS preflight requests (OPTIONS) to a locked port reach the app without a key (allow=true), or refuse them like any other request without a key (allow=false, the default for every port). The pod isn't restarted, and the change takes a few seconds to apply. An endpoint's allow_preflight in the pods tool shows the setting.
Use it when a web page on another site calls a locked port from a browser: the browser first sends a preflight request that carries no key, and the lock refuses it (a CORS error in the page). Every other request still needs a key, and the app's own CORS settings decide which sites may call it.
allow=true opens a way past the lock, so do it only when the user asks. With confirm=false (default) it only returns a summary and changes nothing; call again with confirm=true and the summary's pod_name after the user agreed. Tell the user that a key put in a web page is visible to everyone who opens that page: that page should get its own key, rolled if it leaks. allow=false applies at once, without confirm.
The setting is kept when the port is unlocked and locked again; it does nothing while the port is unlocked. Only a workspace admin or billing member can change it. An internal port has no such setting (port_not_public).
Every write requires operation_id. Reuse the ID returned by the preview, or generate a UUID before the first call. Keep it for confirmation and all retries; a new ID means a new operation. After a timeout, check operation_status and resource state before retrying.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pod": "<pod>",
"port": "<port>",
"allow": "<allow>"
},
"name": "set_port_preflight"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pod | Yes | The pod_name from the pods tool. Its display name also works, except on a confirmed call (confirm=true) that opens a port, changes a key or signs out browsers: use the `pod_name` the preview returned. | |
| port | Yes | The port number, from the pod's `endpoints` in the pods tool; it must be exposed over HTTPS (`access` locked or unlocked). | |
| allow | Yes | ||
| confirm | No | ||
| workspace | No | ||
| operation_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||