node.js - 通过正常的浏览器连接代理phantomjs?

标签 node.js browser phantomjs same-origin-policy

是否可以通过浏览器(如chrome)连接代理phantomJS?我的用例是这样的:图我有一个为用户运行的服务器端幻像进程,但我想使用用户计算机来实际发送请求(这样可以使用用户 ip 和 header 。)

有什么办法可以做到这一点吗?这会违反 CORS

最佳答案

您可以创建 Node.js 代理 https://github.com/nodejitsu/node-http-proxy

然后通过 selenium-node-webdriver 将请求转发到您的 phantom

然后,当页面在幻象中完成加载时,返回源。

https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/source

不确定为什么要这样做 - 除非您想在服务器端获取屏幕截图?

关于node.js - 通过正常的浏览器连接代理phantomjs?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31755915/

相关文章:

javascript - Node.JS 和 Object.Keys 与 json

node.js - Mocha : How to test Express rendered views

Javascript - 确定对 Element.children 功能的支持

javascript - 通过 JS 或 CSS 的浏览器历史记录

javascript - 使用 phantomjs 调用函数给出的结果与从控制台调用的结果不同

phantomjs - Windows 上的 casperjs.bat 失败,并出现找不到模块 cli.js 错误

node.js - #Handlebars 中的每个助手不会迭代带有括号的键

javascript - Node Express API 对 Angular $http 调用响应不佳

url - 如果 #hashes 不是 URL 请求的一部分,它们如何在 URL 方案中工作?

python - PhantomJS - 连接到 GhostDriver 错误