Javascript在本地测试Web服务-CORS
我正试图在本地构建一个jQuery移动应用程序,通过XMLHttpRequest/XCRF/JSON连接到我的网站。尝试连接到我的网站时,我遇到以下错误: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
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项目及其连接方式吗?