为 CORS 回显 "Origin" 的值而不是使用“*”?

Echoing the value of "Origin" for CORS instead of using "*"?

根据MDN

when responding to a credentialed request, server must specify a domain, and cannot use wild carding.

所以我不能简单地使用Access-Control-Allow-Origin: *。但是,我想知道是否有理由不简单地使用:Access-Control-Allow-Origin: ${request.headers["Origin"]},即始终将 Access-Control-Allow-Origin 设置为请求中设置的任何 Origin

没有。

已在该线程中(而不是间接地)讨论过:Access-Control-Allow-Origin Multiple Origin Domains?

在你的例子中,你的域列表都是域,这意味着无论请求来自什么,它都在你的 'list of domains'.