Files
droid2api/config.json
empty eef909c5dd feat: 实现可配置的 CORS 安全策略
- 添加 getCorsConfig() 函数支持灵活的 CORS 配置
- 支持三种模式:禁用 CORS、白名单、允许所有来源
- 环境变量可覆盖 config.json 配置 (CORS_ENABLED, CORS_ALLOW_ALL, CORS_ORIGINS)
- config.json 默认使用白名单模式,仅允许 localhost
- 动态验证 Origin 头,不在白名单的请求不设置 CORS 头
- 添加 Vary: Origin 头支持 CDN 缓存

安全改进:
- 生产环境默认 allow_all=false,避免 CORS 通配符
- 白名单模式下,未授权来源的请求会被浏览器拒绝

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 15:33:04 +08:00

106 lines
2.4 KiB
JSON

{
"port": 3000,
"model_redirects": {
"claude-3-5-haiku-20241022": "claude-haiku-4-5-20251001",
"claude-sonnet-4-5": "claude-sonnet-4-5-20250929"
},
"endpoint": [
{
"name": "openai",
"base_url": "https://api.factory.ai/api/llm/o/v1/responses"
},
{
"name": "anthropic",
"base_url": "https://api.factory.ai/api/llm/a/v1/messages"
},
{
"name": "common",
"base_url": "https://api.factory.ai/api/llm/o/v1/chat/completions"
}
],
"proxies": [],
"models": [
{
"name": "Opus 4.5",
"id": "claude-opus-4-5-20251101",
"type": "anthropic",
"reasoning": "auto",
"provider": "anthropic"
},
{
"name": "Haiku 4.5",
"id": "claude-haiku-4-5-20251001",
"type": "anthropic",
"reasoning": "auto",
"provider": "anthropic"
},
{
"name": "Sonnet 4.5",
"id": "claude-sonnet-4-5-20250929",
"type": "anthropic",
"reasoning": "auto",
"provider": "anthropic"
},
{
"name": "GPT-5.2",
"id": "gpt-5.2",
"type": "openai",
"reasoning": "auto",
"provider": "openai"
},
{
"name": "GPT-5.1",
"id": "gpt-5.1",
"type": "openai",
"reasoning": "auto",
"provider": "openai"
},
{
"name": "GPT-5.1 Codex",
"id": "gpt-5.1-codex",
"type": "openai",
"reasoning": "off",
"provider": "openai"
},
{
"name": "GPT-5.1 Codex Max",
"id": "gpt-5.1-codex-max",
"type": "openai",
"reasoning": "auto",
"provider": "openai"
},
{
"name": "GLM-4.6",
"id": "glm-4.6",
"type": "common",
"reasoning": "off",
"provider": "fireworks"
},
{
"name": "Gemini-3-Pro",
"id": "gemini-3-pro-preview",
"type": "common",
"reasoning": "auto",
"provider": "google"
},
{
"name": "Gemini-3-Flash",
"id": "gemini-3-flash-preview",
"type": "common",
"reasoning": "auto",
"provider": "google"
}
],
"cors": {
"enabled": true,
"allow_all": false,
"origins": [
"http://localhost:3000",
"http://localhost:5173",
"http://127.0.0.1:3000"
]
},
"dev_mode": false,
"user_agent": "anthropic-cli/0.40.2",
"system_prompt": "You are Claude, an AI software engineering agent built by Anthropic.\n\n"
}