DevToolBox免费
博客

CORS 测试工具

测试任意 URL 的 CORS(跨域资源共享)头信息。检查 Access-Control-Allow-Origin、方法、头信息和凭据支持。

免费在线 CORS 测试工具

输入 URL 和源站来测试 CORS 头信息。此工具从浏览器发送实际 HTTP 请求,检查目标服务器是否允许指定源站的跨域请求。

如何测试 CORS 头信息

  1. 输入要测试的 URL
  2. 设置 Origin 头(发起请求的域名)
  3. 选择测试的 HTTP 方法
  4. 点击"测试 CORS"或"发送预检请求"检查头信息

功能特性

  • 测试任意 URL 的 CORS 头信息
  • 发送预检 OPTIONS 请求
  • 查看 Access-Control-Allow-Origin、方法、头信息
  • 检查凭据和 max-age 支持
  • 基于真实浏览器的 CORS 测试

常见问题

什么是 CORS?
CORS(跨域资源共享)是一种安全机制,允许一个域的网页请求另一个域的资源。服务器必须包含特定的 HTTP 头才能允许跨域请求。
什么是预检请求?
预检请求是浏览器在某些跨域请求之前发送的 OPTIONS 请求。它通过验证允许的方法、头信息和源站来检查实际请求是否安全。
Access-Control-Allow-Origin 是什么意思?
此头信息指定哪些源站被允许访问资源。可以是特定源站或通配符 (*) 允许任何源站。
为什么我的 CORS 请求被阻止?
当服务器未包含与您源站匹配的 Access-Control-Allow-Origin 头,或预检响应中不允许所需方法/头时,CORS 请求会被阻止。
可以从浏览器测试 CORS 吗?
可以。此工具直接从浏览器发送请求,准确反映浏览器如何处理给定 URL 和源站组合的 CORS。

相关工具

𝕏 Twitterin LinkedIn

💬 User Feedback

Have suggestions or found a bug? Leave a message and we'll get back to you.
0/2000

评价此工具

3.8 / 5 · 40 人评价

保持更新

获取每周开发技巧和新工具通知。

无垃圾邮件,随时退订。

Enjoy these free tools?

Buy Me a Coffee

How to Use

  1. Enter the API endpoint URL to test
  2. Select HTTP method and add headers if needed
  3. Click Test to send the CORS preflight request
  4. Review the CORS headers in the response

Common Use Cases

  • Debugging CORS errors in APIs
  • Verifying server CORS configuration
  • Testing preflight request handling
  • Checking allowed origins and methods

Frequently Asked Questions

What is CORS?
CORS (Cross-Origin Resource Sharing) is a security mechanism that controls how web pages can request resources from a different domain.
Why am I getting CORS errors?
The server must include proper Access-Control-Allow-* headers. Without these, browsers block cross-origin requests for security.
Can I fix CORS on the client side?
No. CORS must be configured on the server. Client-side workarounds like JSONP are outdated and insecure.