Questions tagged [node-http-proxy]

A full-featured http proxy for node.js

271 questions
5
votes
3 answers

Get response from proxy server

I created a proxy server in node.js using the node-http-proxy module. Looks like this: var http = require('http'), httpProxy = require('http-proxy'), io = require("socket.io").listen(5555); var proxy = new…
Psycho
  • 335
  • 2
  • 7
5
votes
1 answer

EC2 hosted Node.js application - can't remotely connect to port

Update: Turns out the only problem was that I was behind a firewall that blocked some ports, but not 8000. Edit: TL;DR: can't connect to port 9000 remotely, but port 8000 is ok and I don't know why :( I've got this node.js application that's…
Andrei Mustata
  • 1,013
  • 1
  • 9
  • 21
5
votes
3 answers

How do I use node.js http-proxy for logging HTTP traffic in a computer?

I am trying to implement the simplest example: var http = require('http'), var httpProxy = require('http-proxy'); httpProxy.createServer(function (req, res, proxy) { // // I would add logging here // proxy.proxyRequest(req, res, {…
gztomas
  • 3,030
  • 3
  • 27
  • 38
5
votes
1 answer

Getting Node-http-proxy to work with socket.io?

I am trying to use node-http-proxy to direct traffic to port 3000 (my rails server) and port 8888 (my nodejs socket.io server). I am using node-http-proxy to act as a reverse proxy sitting on port 80. (I pretty much just copy the README from…
xjq233p_1
  • 7,810
  • 11
  • 61
  • 107
4
votes
2 answers

Vite react proxy sends requests to different endpoints depending on current location

After switch to vite, I am trying to mimic proxy: "http://localhost:5000" which I previously used in package.json Here is my vite config export default defineConfig({ plugins: [react()], server: { proxy: { "/api": { target:…
pakut2
  • 500
  • 5
  • 21
4
votes
0 answers

Modify Request Body as JSON with Node.js proxy middleware

I'm using node-http-proxy as middleware. When handling GET requests it's ok. For POST requests with JSON body, I cannot send the application/json header and the body json encoded. This is my middleware. I have added the reastream option as…
loretoparisi
  • 15,724
  • 11
  • 102
  • 146
4
votes
0 answers

Node Proxy convert proxied response buffer to string

i am trying to make an HTTP proxy usng nodejitsu/node-http-proxy and i got this methods to catch proxied responses proxy.on('proxyRes', function (proxyRes, req, res) { var body = new Buffer(''); proxyRes.on('data', function (data) { …
inval
  • 380
  • 1
  • 4
  • 11
4
votes
0 answers

Request delay when accessing proxied server from Chrome

I am using Vue.js's API proxying functionality (which internally uses http-proxy-middleware/http-proxy) to forward API requests to my localbackend server. I set it in vue.conf.js like so: module.exports = { devServer: { port: 8081, …
4
votes
1 answer

Why does https.Agent throw a parse error when proxying via node-http-proxy?

I would like to enable the use of connection pooling via http.Agent and https.Agent in my node-http-proxy application. To do this I've established a secure agent, like so: const secureAgent = new https.secureAgent({ keepAlive: true }); (I've elided…
maxcountryman
  • 1,562
  • 1
  • 24
  • 51
4
votes
2 answers

Node http-proxy / http-proxy-middleware - How do you manipulate proxy response

I'm using Express 4, and I'm using a middleware http-proxy-middleware ( https://github.com/chimurai/http-proxy-middleware), and having the following issues In normal way, I can do the following to manupulate the response before return to the…
R.R
  • 847
  • 1
  • 9
  • 20
4
votes
1 answer

Configure webpack-dev-server to play nice with different existing vhosts for assets and application

I am trying to set up non-standard webpack-dev-server proxy configuration. Following reading: http://webpack.github.io/docs/webpack-dev-server.html#combining-with-an-existing-server Basically my local web server web root is: http://website.dev and…
Elise Chant
  • 5,048
  • 3
  • 29
  • 36
4
votes
2 answers

Using Express proxy, how to change the relative url?

In order to avoid the typical CORS problem with client-side javascript code I use a nodejs express server. This server contains the following code: var app = express(); app.all('/Api/*', function (req, res) { proxy.web(req, res, { …
Joris Mans
  • 6,024
  • 6
  • 42
  • 69
4
votes
0 answers

Node Prerender/PhantomJS + http-proxy not working with websocket

I wrote a reverse proxy for my website to serve as a load balancer. I wrote it with Node, using the nodejitsu hppt-proxy. My site is an AngularJS app that uses a websocket connection to fetch data from the server. The http-server is a node Express…
hubbabubba
  • 937
  • 1
  • 9
  • 17
4
votes
2 answers

Gulp Browsersync and http-proxy-middleware in offline mode

Does Browsersync with http-proxy-middleware work offline if I am proxying to a localhost server? I have an angular app deployed at localhost:3000 making requests for an api-server deployed at localhost:8080. The http requests to the api-server are…
Fabricio Lemos
  • 2,905
  • 2
  • 31
  • 31
4
votes
1 answer

Hosting two Node.JS apps on same domain

I have two node js applications I am running on the same box and I would like for it to run the first node js app for all routing except if the url is www.domain.com/blog to go to the other node js application. Is this even possible with this setup…
user1200387
  • 625
  • 2
  • 13
  • 22