Files
nexus/wiki/concepts/CORS-Allowlist.md
2026-05-03 05:42:12 +08:00

29 lines
949 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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