Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.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 Phantomjs浏览器不支持网页上的CORS请求_Javascript_Angularjs_Node.js_Seo_Phantomjs - Fatal编程技术网

Javascript Phantomjs浏览器不支持网页上的CORS请求

Javascript Phantomjs浏览器不支持网页上的CORS请求,javascript,angularjs,node.js,seo,phantomjs,Javascript,Angularjs,Node.js,Seo,Phantomjs,我想拍摄我的angularjs SPA的html快照。Angular应用程序正在从另一个域上的tomcat服务器获取数据。SPA可以在chrome浏览器上成功获取数据,但在phantomjs浏览器中会出现以下错误 ERROR{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"https://localhost:8443/gomovi

我想拍摄我的angularjs SPA的html快照。Angular应用程序正在从另一个域上的tomcat服务器获取数据。SPA可以在chrome浏览器上成功获取数据,但在phantomjs浏览器中会出现以下错误

ERROR{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"https://localhost:8443/gomovie/control/getHomeData","headers":{"Content-Type":"application/json","Accept":"application/json, text/plain, */*"},"data":""},"statusText":""} (from line #undefined in "undefined")

Angular应用程序是使用nodejs服务器提供的,如果url中有?_转义的u片段u,它会调用phantom js来拍摄HTML快照。服务器是使用ApacheOfBiz部署的,ApacheOfBiz在内部使用tomcat。我使用了Tomcat提供的默认cors过滤器来支持服务器端的cors,它至少可以在chrome和firefox上运行。

我解决了这个问题。问题不在于CORS请求,而在于SSL握手错误

有关解决方案,请参阅此链接:


使用phantomjs-ignore ssl errors=yes[phantomOptions]script.js[scriptOptions]解决了这个问题。

服务器响应头是什么?如果您能告诉我您试图使用的url,我可以看看phantomjscloud.com是否能更好地呈现它。如果是这样的话,我也许能给你一个暗示,说明你做错了什么