0

I want to take an html snapshot of my angularjs SPA. Angular application is getting data from tomcat server on another domain. SPA can successfully get data if on chrome browser, but get following error when inside phantomjs browser.

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 app is served using a nodejs server, which call phantom js to take HTML snapshot, if the url has ?_escaped_fragment_ in it. Server is deployed using apache ofbiz which uses tomcat internally. I have used default cors filter provided by Tomcat to support CORS on server side (and it works on chrome and firefox atleast).

Tanmay_vijay
  • 569
  • 3
  • 12
  • What are the server response headers? – gautsch Nov 10 '15 at 21:03
  • if you can tell me the url you are trying to use, i can see if phantomjscloud.com renders it better. if so, i might be able to give a hint as to what you are doing wrong – JasonS Nov 11 '15 at 16:25

1 Answers1

0

I solved the issue. The problem was no with CORS request but with SSL handshake error.

For solution refer to this link : PhantomJs failling to open HTTPS sites

Use of phantomjs --ignore-ssl-errors=yes [phantomOptions] script.js [scriptOptions] solved the problem.

Community
  • 1
  • 1
Tanmay_vijay
  • 569
  • 3
  • 12