PhantomJS failing to open HTTPS site

后端 未结 12 1917
梦如初夏
梦如初夏 2020-11-22 07:53

I\'m using the following code based on loadspeed.js example to open up a https:// site which requires http server authentication as well.

var page = require(         


        
12条回答
  •  悲哀的现实
    2020-11-22 08:04

    None of the other answers here helped me; it may be that the specific site(s) I was working with were too picky with their HTTP headers. This is what worked:

    var page = webpage.create();
    page.customHeaders = {
        "Connection": "keep-alive"
    };
    

    I found out that PhantomJS was using "Keep-Alive" (capitalized), and the connection was not being kept alive. :)

提交回复
热议问题