跨域字段 allow-headers 和 expose-headers 的区别
关于跨域资源中这两个误会了两次的字段
Never step into a same pit three times.
access-control-allow-headers
access-control-expose-headers
about cors
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served.
CORS 即跨域资源共享, 它允许浏览器请求和不同源服务器的资源.
concept
a preflight request
指的就是 CORS 过程中发起的 OPTIONS 请求the actual request
指的就是实际发出的请求
access-control-allow-headers
Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.
指的是在the actual request
的请求中可以带上哪些头部
access-control-expose-headers
The Access-Control-Expose-Headers header indicates which headers are safe to expose to the API of a CORS API specification.
指的是浏览器发出the actual request
得到 response, 浏览器可以使用/读取哪些 response 中的 headers
playground
nginx
1 | worker_processes 1; |