Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript在本地测试Web服务-CORS_Javascript_Android_Web Services - Fatal编程技术网

Javascript在本地测试Web服务-CORS

Javascript在本地测试Web服务-CORS,javascript,android,web-services,Javascript,Android,Web Services,我正试图在本地构建一个jQuery移动应用程序,通过XMLHttpRequest/XCRF/JSON连接到我的网站。尝试连接到我的网站时,我遇到以下错误: XMLHttpRequest cannot load http://wwws.mydomain.com/rest/system/connect. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials fla

我正试图在本地构建一个jQuery移动应用程序,通过XMLHttpRequest/XCRF/JSON连接到我的网站。尝试连接到我的网站时,我遇到以下错误:

XMLHttpRequest cannot load http://wwws.mydomain.com/rest/system/connect. 
A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. 
Origin 'http://localhost' is therefore not allowed access.
根据CORS文档,我在我的Web服务器mydomain.com上启用了CORS:

Header always set Access-Control-Allow-Origin "*"

如何从网站外部测试我的Web服务?当它转换为Android应用程序时,我会遇到类似的问题吗?

这是安全性的一部分,您不能这样做。如果要允许凭据,则访问控制允许源站不能使用*

查看以下线程:

这很好,我可以手动设置域,但这会影响Phonegap项目及其连接方式吗?