29 lines
949 B
Markdown
29 lines
949 B
Markdown
---
|
||
title: "CORS-Allowlist"
|
||
type: concept
|
||
tags: []
|
||
sources: [expose-hermes-agent-as-an-openai-compatible-api-for-any-frontend]
|
||
last_updated: 2026-05-02
|
||
---
|
||
|
||
## Definition
|
||
CORS Allowlist(跨域资源共享白名单)是一种浏览器安全机制,通过精确配置允许特定来源的跨域请求。
|
||
|
||
## Purpose
|
||
当浏览器中的前端应用(如 Open WebUI)调用不同域的后端 API 时,浏览器会先发送预检请求(OPTIONS),服务器需明确允许该来源才能放行。
|
||
|
||
## Configuration in Hermes Agent
|
||
Hermes Agent API Server 支持 CORS Allowlist 配置:
|
||
- **环境变量**:`CORS_ALLOWED_ORIGINS` 设置允许的域名列表
|
||
- **默认值**:仅允许配置列表中的来源
|
||
- **安全建议**:生产环境仅开放必要的域名
|
||
|
||
## Example
|
||
```
|
||
CORS_ALLOWED_ORIGINS=https://app.openwebui.com,https://chat.example.com
|
||
```
|
||
|
||
## Related
|
||
- [[OpenAI-Compatible-API]]
|
||
- [[hermes-agent]](via Hermes-Agent.md)
|