Tag: 代理

npm install – >隧道套接字无法build立

这个错误信息在堆栈溢出已经被回答了好几次,但是所有的解决scheme都不适合我。 每当我做npm install我得到以下消息: npm ERR! network tunneling socket could not be established, statusCode=407 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm […]

Node.js响应asynchronous数据

最近我开始学习一些关于Node.js和它的function,并尝试将它用于一些Web服务。 我想创build一个Web服务,它将作为Web请求的代理。 我希望我的服务以这种方式工作: 用户将访问我的服务 – > http://myproxyservice.com/api/getuserinfo/tom 我的服务将执行请求 – > http://targetsite.com/user?name=tom 响应的数据会反映给用户。 为了实现它,我使用了下面的代码: app.js: var express = require('express'); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); var proxy = require('./proxy_query.js') function makeProxyApiRequest(name) { return proxy.getUserData(name, parseProxyApiRequest); } function parseProxyApiRequest(data) { returned_data = JSON.parse(data); if (returned_data.error) { console.log('An eror has occoured. […]

在Node.js请求模块上设置{“agent”:false}

如何在请求模块上设置“代理”为false? 比如我可以在http core [2]模块上做些什么? [1] http://npmjs.org/request [2] https://nodejs.org/api/http.html#http_class_http_agent

如何在Express中代理外部站点

我正在试图使一个代理服务器,加载我的域名下的外部网站。 我的目标是让人们访问myDomain.com/anyDomain.com,并能够使用anyDomain.com添加function(注入JS)。 我尝试使用请求包获取该网站的HTML,然后将其发送到快速响应,但这种方法弄乱了网站(相对path,缺lessCSS,错误的JS请求等)。 有没有任何节点包完成这个任务? 如果不是,我该怎么做呢? 谢谢!

Express JS通配符路由代理

我正在使用express-http-proxy来代理后端服务器。 我想所有的请求/代理/代理/苹果/品牌或/代理/橙子/品牌/ nnnn等被代理到后端服务。 所以,我在这里设置了一个通配符代理。 'use strict'; var express = require('express'); var proxy = require('express-http-proxy'); var app = express(); // "" app.use('/proxy*', proxy('https://backend-server.com/' ,{ forwardPath: function(req, res) { console.log(req.url) return require('url').parse(req.url).path; } })); var port = 3000; app.listen(port, function() { console.log('listening on port ' + port + '.') }); 我期望这个https:// localhost:3000 / proxy / oranges / […]

无法在node.js上设置代理

我有端口5550上的node.js 4.1.1和express.js 4.8.5。端口8080上也有Geoserver 2.8.0。两台服务器都在同一台笔记本电脑上。 节点上的应用程序想要访问来自Geoserver的一些地图数据,这些是关于Openlayers的细节 source: new ol.source.TileWMS({ url: 'http://localhost:8080/geoserver/mymap/wms?', crossOrigin: 'anonymous', // I also tried crossOrigin: 'localhost:8080/' and crossOrigin: 'localhost:5550/' but nothing params: {'LAYERS': 'mymap:layer, mymap:anotherLayer, FORMAT': 'image/png' ,'CRS': 'EPSG:3857'}, serverType: 'geoserver' 在Geoserver上设置CORS或代理是不可能的,因为技术问题(旧的Jetty核心,在旧的Jetty版本的野生的,不可用的jars上的hack-ish解决scheme)。 为了避免CORS和Access Control Allow Origins错误我想在节点上设置一个代理。 我只是想使用节点,因为它更容易设置。 根据这个和以前的问题,我必须设置一个反向代理,所以 我不在客户端上进行代理configuration Geoserver通过一个节点反向代理服务器,看起来像他们有相同的起源(=没有更多的CORS问题) 客户端想要访问Geoserver,但不知道它通过节点 我想我的概念是正确的,但我不知道如何实现这一点。 我select了http-proxy-middleware来做到这一点。 我在我的app.js上添加了 var proxyMiddleware = require('http-proxy-middleware'); var proxy = proxyMiddleware('http://localhost:8080/geoserver', { […]

Javascript – 从不同的国家发送singel http请求

我需要发送多个http请求。 但是,每个请求应该来自不同的国家。 我想通过VPN来做到这一点。 我没有find任何JavaScript的lib通过VPN发送单个http请求.. 来自后端的Http请求 – NodeJs有可能吗? 谢谢!

服务器没有返回JSON从Express到React(代理)

我正在尝试制作一个具有React前端(在端口8080上运行)和一个Express-Node.js后端(在端口3000上)的应用程序。 我希望我的客户使用fetch从我的服务器请求数据。 到目前为止,我在线阅读的内容表明,我需要使用http://localhost:3000的值向我的package.json添加一个proxy项。 我这样做了,我的服务器正确接收请求,但它的响应不是我所期望的(一个JSON对象)。 我究竟做错了什么? //Server app.get('/search', function(req, res) { … //console.log(section) <– Is the correct value res.json(section); }) … app.listen(3000) //Client handleTouchTap() { fetch('/search?crn=10001').then(function(response) { //<– Hard-coded for testing return response; //<– Does not contain the value of "section" from server }).then(function(data) { console.log(data); //<– Likewise, does not contain the value }); } //From […]

请求库不正确地通过代理来引导HTTP请求

我知道如何使用requests ,但由于某种原因,我没有成功地让代理工作。 我正在提出以下要求: r = requests.get('http://whatismyip.com', proxies={'http': 'http://148.236.5.92:8080'}) 我得到以下内容: requests.exceptions.ConnectionError: [Errno 10060] A connection attempt failed b ecause the connected party did not properly respond after a period of time, or e stablished connection failed because connected host has failed to respond 然而,我知道代理工程,因为使用节点: request.get({uri: 'http://www.whatismyip.com', proxy: 'http://148.236.5.92:8080'}, function (err, response, body) {var $ = cheerio.load(body); […]

如何在企业networking代理之后设置Node.js和Npm

如何configurationnode.js和npm在Web代理后面运行? 我尝试了以下解决scheme,但他们不适合我。 npm config set proxy http://proxy.company.com:8080 和 npm config set proxy http://username:password@proxy.company.com:8080