sto lavorando in Node.js progetto e voglio nodo di agire come un proxy per solrSocket hangup durante la pubblicazione richiesta al nodo-http-proxy Node.js
per Proxy: ho usato Node-http-proxy. il problema è che il lavoro di proxy eccellente nel caso di richieste GET, ma in caso di richieste POST si traduce in presa riagganciare eccezione
Ecco un esempio del mio codice nodo
var express = require('express');
var router = express.Router();
var http = require('http');
var httpProxy = require('http-proxy')
var proxyOptions = {
host: "127.0.0.1",
port: 8983
};
var proxy = httpProxy.createProxyServer(proxyOptions);
// It works excellent in GET request
router.get('/solr/*', function(req, res) {
proxy.web(req, res, {
target: 'http://' + proxyOptions.host + ':' + proxyOptions.port
});
})
// the socket hang up in post request
router.post('/solr/*', function(req, res) {
console.log('Post Request');
proxy.web(req, res, {
target: 'http://' + proxyOptions.host + ':' + proxyOptions.port
});
})
E questo è l'errore dopo qualche tempo in consolle nodo
Error: socket hang up
at createHangUpError (http.js:1476:15)
at Socket.socketOnEnd [as onend] (http.js:1572:23)
at Socket.g (events.js:180:16)
at Socket.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
Eventuali suggerimenti circa la causa del problema
https://github.com/nodejitsu/node-http-proxy/issues/180#issuecomment-12244852 sembra di fare qualcosa con usando espresso – alandarev