知识卡片

普通读书笔记卡 · 3516.a

CORS允许来源应收窄

理解等级:中级

CORS 中间件负责声明允许的来源、方法和请求头。演示环境可用通配符,生产环境应限定可信来源与实际需要的请求能力;CORS 只约束浏览器跨源行为,不能代替 API 的身份与资源授权。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 11 章《API authorization and authentication》(源文件:_epub-src/OEBPS/Text/11.htm) - 结论依据:原文明确通配符仅为测试,并要求生产限制可信来源。 - 原始内容:For testing purposes, we’re using wildcards to allow all origins, methods, and headers, but in your production environment you must be more specific. In particular, you must restrict the allowed origins to your website’s domain and other trusted origins.