Proxy a HEAD request to a sandbox port
`HEAD` to an app listening on a sandbox port, reached only through `usercontent.b3os.org` port previews. Token check, forwarding and limits are the same as for `GET` (`sandboxesProxyPortGet`).
HEAD
/v1/sandboxes/{sandbox_id}/ports/{port}/proxy/{rest}
`HEAD` to an app listening on a sandbox port, reached only through `usercontent.b3os.org` port previews.
Token check, forwarding and limits are the same as for `GET` (`sandboxesProxyPortGet`).
Path Parameters
sandbox_id
string
required
path
The sandbox ID (`sbx_…`).
Example:
"sbx_01m5t68q1b590rj801nbzsqzkk"port
integer
required
path
A port declared in the sandbox's `ports`.
Example:
3000rest
string
required
path
The rest of the path after the usercontent prefix, slashes included, possibly empty (the app's root). Passed
to the app as `/<rest>` byte for byte.
Example:
"assets/app.js"Header Parameters
x-b3os-port-token
string
required
header
The port token from the usercontent path (`pt1.<node>.<exp>.<sig>`; see `sandboxesProxyPortGet`), set by the
usercontent Worker. Missing, malformed, expired or not matching this sandbox and port: `403 signed_url_invalid`.
Example:
"pt1.n1.1792955460.tjsgjiRC3sSYEwneW62TSvNqd-Jo_zzFI5zFYkB_YQBNl0CiBzI9xgoV6EJD_5YEmh3HbzSmb3acL8mY1LmYCg"Responses
200
The app's response, passed through (any status, headers and body; `Set-Cookie` removed).
No response body
400
The request failed validation (`invalid_request`, `invalid_url`).
403
The port token is missing, malformed, expired, for another sandbox or port, or not signed by this node (`signed_url_invalid`).
404
No such sandbox, or the port is not declared in its `ports` (`sandbox_not_found`, `port_not_exposed`).
409
The sandbox is paused or stopped (`sandbox_not_running`).
429
A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500
Something failed inside B3OS (`internal`). Retry with backoff.
502
Nothing in the sandbox accepted a connection on the port (`upstream_unreachable`), or the guest agent did not answer (`guest_unreachable`).
503
The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X HEAD 'https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/ports/3000/proxy/assets/app.js' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'x-b3os-port-token: pt1.n1.1792955460.tjsgjiRC3sSYEwneW62TSvNqd-Jo_zzFI5zFYkB_YQBNl0CiBzI9xgoV6EJD_5YEmh3HbzSmb3acL8mY1LmYCg'
const response = await fetch('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/ports/3000/proxy/assets/app.js', { method: 'HEAD', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "x-b3os-port-token": "pt1.n1.1792955460.tjsgjiRC3sSYEwneW62TSvNqd-Jo_zzFI5zFYkB_YQBNl0CiBzI9xgoV6EJD_5YEmh3HbzSmb3acL8mY1LmYCg" }});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN', 'x-b3os-port-token': 'pt1.n1.1792955460.tjsgjiRC3sSYEwneW62TSvNqd-Jo_zzFI5zFYkB_YQBNl0CiBzI9xgoV6EJD_5YEmh3HbzSmb3acL8mY1LmYCg'}response = requests.head('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/ports/3000/proxy/assets/app.js', headers=headers)print(response.json())
400
Response
{ "type": "https://docs.beta.b3os.org/errors#invalid_request", "title": "Invalid request", "status": 400, "code": "invalid_request", "detail": "1 field failed validation", "instance": "req_01m5t4yg394wegr3j4y01qb363", "errors": [ { "pointer": "/url", "detail": "must be an absolute http or https URL" } ]}
API Playground
Try this endpoint
HEAD
/v1/sandboxes/{sandbox_id}/ports/{port}/proxy/{rest}