Security Domain Management
v3.0.0+
The tcb cors command has been available since v3.0.0, replacing the security domain feature of the original tcb service.
Security domains are used to restrict which domains can access TCB resources (such as databases, storage, SCF, etc.) via the Web SDK. Only domains in the security domain allowlist can initiate requests from the browser side.
The difference between cors and domains
tcb cors: Manages the allowlist for Web SDK security domains, controlling which web domains can access TCB resources (via CORS authentication).tcb domains: Manages custom domains for HTTP access services, requiring SSL certificate binding and working in conjunction with routing rules. For details, see Custom Domain Management.
View Security Domain List
List all security domains in the current environment:
tcb cors list -e <envId>
Example Output:
Domain Id Domain Creation Time Status
1001 example.com 2025-01-01 10:00:00 Enabled
1002 test.example.com 2025-01-02 10:00:00 Enabled
Add Security Domain
Add one or more security domains to the current environment, with multiple domains separated by commas:
# Add Single Domain
tcb cors add example.com -e <envId>
# Add Multiple Domains Simultaneously
tcb cors add example.com,test.example.com -e <envId>
Caution
- Duplicate domains cannot be added. Adding duplicates will throw an error and prompt you to delete them first before retrying.
- The domain format should be a valid domain, excluding
http://orhttps://prefixes
Delete Security Domain
Delete one or more security domains from the current environment, with multiple domains separated by commas:
# Delete Single Domain
tcb cors rm example.com -e <envId>
# Delete Multiple Domains Simultaneously
tcb cors rm example.com,test.example.com -e <envId>
Caution
The domain to be deleted must already exist in the security domain list; otherwise, an error will be thrown.
Command Quick Reference
| Command | Description |
|---|---|
tcb cors list | List security domains |
tcb cors add <domain> | Add security domains, with multiple domains separated by commas |
tcb cors rm <domain> | Delete security domains, with multiple domains separated by commas |