node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Get the response data from target server with express

Open Teenymario opened this issue 2 years ago • 0 comments
trafficstars

I have a node.js application that runs with express and with http-proxy. Now the express server is where client requests come in and then the requests are forwarded to an internal php server I have an endpoint that forwards requets to a php file called chatHandler.php which would respond with json data back to the client. I would like to read the json response the internal server gives. This is how the endpoint looks app.post('/ChatHandler.php', (req, res, next) => { proxy.web(req, res, { target: 'http://localhost:8081/ChatHandler.php' }, next); }); Before the request is returned to the client I want to see what the response from "http:localhost:8081/ChatHandler.php" was, like the body of the response where the json data is.

Teenymario avatar Jul 30 '23 22:07 Teenymario