Access-Control-Allow-Origin header 的默认值是多少?

What is the default value of Access-Control-Allow-Origin header?

“*”或服务器的 URI 是 Access-Control-Allow-Origin header 的默认值吗? 如果 header 没有设置,是否意味着每个源都可以访问该资源?

没有默认值。

如果未设置,则未设置。如果设置了,那么它必须有一个明确的值。

If the header is not set, does it mean that every origin has access to the resource?

没有。这意味着同源策略被正常执行。没有任何来源被授予权限。

the server's URI

没有理由将 Access-Control-Allow-Origin 设置为服务器自己的 URL。同源请求不需要 CORS 的许可。

在寻找没有 CORS 的情况下工作的 headers 时发现了这个,并从 Mozilla 找到了这个不错的安全列表:https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_request_header

A CORS-safelisted request header is one of the following HTTP headers:

Accept,
Accept-Language,
Content-Language,
Content-Type.