Sunday, 9 April 2017

how to buffer and extract information from server response

My scenario as follows:

client <---> proxy <---> server

and I am working on the proxy entity (nodejs + express). The client will initialize a request to the proxy, and the proxy changes http header and forwards the request message to the server. After getting a response from the server, I want to make some changes to the HTML and then forward to the client. What is the best way? Here is the code for forwarding.

res.writeHeader(serverResponse.statusCode, serverResponse.headers);

serverResponse.pipe(res, {end:true});

serverResponse.resume();



via fetag

No comments:

Post a Comment