Websocket协议
在阅读本篇文章之前,你已经阅读了:
在nginx配置了Allow-Credentials为true时,且Allow-Origin为通配符*
时:1
2add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
浏览器会提示报错:1
Access to XMLHttpRequest at 'http://127.0.0.1:8081/test' from origin 'http://127.0.0.1:8081' has been blocked by CORS policy: 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'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
在对接海康卫视WEB无插件开发包时,自己的页面连接单独的摄像头时(连接NVR没这个问题),/ISAPI/Security/sessionLogin
接口会报错误:
1 | Access Error: 400 -- Bad Request |