Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8129461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:19:03+00:00 2026-06-06T08:19:03+00:00

We have the following example in node.js var http = require(‘http’); http.createServer(function(request, response) {

  • 0

We have the following example in node.js

var http = require('http');
http.createServer(function(request, response) {
    var proxy = http.createClient(8083, '127.0.0.1')
    var proxy_request = proxy.request(request.method, request.url, request.headers);
    proxy_request.on('response', function (proxy_response) {
        proxy_response.pipe(response);
        response.writeHead(proxy_response.statusCode, proxy_response.headers);
    });

    setTimeout(function(){
        request.pipe(proxy_request);
    },3000);
}).listen(8081, '127.0.0.1');

The example listen to a request in 127.0.0.1:8081 and sends it to a dummy server (always return 200 OK status code) in 127.0.0.1:8083.

The problem is in the pipe among the input stream (readable) and output stream (writable) when we have a async module before (in this case the setTimeOut timing). The pipe doesn’t work and nothing is sent to dummy server in 8083 port.

Maybe, when we have a async call (in this case the setTimeOut) before the pipe call, the inputstream change to a state “not readable”, and after the async call the pipe doesn’t send anything.

This is just an example…we test it with more async modules from node.js community with the same result (ldapjs, etc)…

We try to fix it with:
– request.readable =true; //before pipe call
– request.pipe(proxy_request, {end : false});
with the same result (the pipe doesn’t work).

Can anybody help us?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:19:06+00:00Added an answer on June 6, 2026 at 8:19 am

    I believe this works as of 0.8.0. I didn’t try in 0.6.11+

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following simple http server using Node.js: var http = require('http'); var
in socket.io 0.6, i have following example code: var io = require('/usr/lib/node_modules/socket.io'); var server
How get node value with its children nodes? For example I have following node
I'm following a simple ajax>php>mysql example posted here http://openenergymonitor.org/emon/node/107 I can only display information
For example I have following jQuery code: var div1 = $(divs).next(); How do I
I have the following 2 lines of code: Dim node As XmlNode = xDoc.SelectSingleNode(//response/agentStatusList/agentStatus/protectableVolumes/protectableVolume/metrics/lastWriteTime)
I have taken the following example from Hands-on Node. It uses some reasonably advanced
I'm trying to figure out how XSLT process namespace prefixes and have following example:
I have the following example code: $dataProvider = new CActiveDataProvider('firstTable', array('criteria' => array( 'select'
I have the following example, compiled in VS2005, warning level 4: int main(int argc,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.