炫意html5
最早CSS3和HTML5移动技术网站之一

加上credentials: ‘include’ 报错

fetch 中加上 credentials: ‘include’ 反而会报错 跨域问题。怎么解决

Response to preflight request doesn’t pass access control check: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’.

回答

当 Access-Control-Allow-Origin 的值为 ‘*’ 的时候跨域请求不允许携带认证
那么只能在服务端修改 Access-Control-Allow-Origin 的值,改成你指定的允许跨域访问的域的值
比如 Access-Control-Allow-Origin: http://192.168.1.1

炫意HTML5 » 加上credentials: ‘include’ 报错

Java基础教程Android基础教程