logo
GeekFormat

CORS Header Builder

CORS 响应头生成

为常见跨域接口生成 Access-Control-Allow-* 头,提前识别通配符和 credentials 的冲突。

生成结果

CORS 检查清单

1. 如果使用 Cookie 或 Authorization 凭据,浏览器不接受 * 作为 Allow-Origin。

2. 预检请求通常还需要服务端正确响应 OPTIONS。

3. 前端只能看到被 Access-Control-Expose-Headers 暴露出来的非简单响应头。

JSON 预览

{
  "headers": [
    {
      "name": "Access-Control-Allow-Origin",
      "value": "https://app.geekformat.com"
    },
    {
      "name": "Access-Control-Allow-Methods",
      "value": "GET, POST, PATCH, DELETE, OPTIONS"
    },
    {
      "name": "Access-Control-Allow-Headers",
      "value": "Content-Type, Authorization, X-Request-Id"
    },
    {
      "name": "Access-Control-Expose-Headers",
      "value": "ETag, X-Trace-Id"
    },
    {
      "name": "Access-Control-Allow-Credentials",
      "value": "true"
    },
    {
      "name": "Access-Control-Max-Age",
      "value": "600"
    }
  ],
  "warnings": []
}