Questions tagged [node-http-proxy]

A full-featured http proxy for node.js

271 questions
2
votes
0 answers

Https proxy server(secure proxy server) in Nodejs with http-proxy is not working

I have a requirement to set up an https proxy server(Secure Web Proxy-http://dev.chromium.org/developers/design-documents/secure-web-proxy) to test one of my application with the proxy environment. Steps followed: 1.Created an https proxy server…
unknown
  • 643
  • 4
  • 15
  • 38
2
votes
0 answers

DNS resolve timeout/delay for domains mapped to localhost in hosts file

I'm actually facing an issue which came up when using the proxy in Angular CLI. But it's not related directly to Angular nor to node.js... it seems to have it's roots some levels deeper (namely on operating system level) ##Short version: When I have…
Bernhard
  • 4,855
  • 5
  • 39
  • 70
2
votes
0 answers

How to handle connect method in node's http-proxy to allow websocket connection through the proxy?

I'm trying to make an HTTP proxy server using node-http-proxy module but I also want to support WebSocket in my proxy server. For that, I have registered an event listener on the upgrade method like following code which is working perfectly if I…
Point Networks
  • 1,071
  • 1
  • 13
  • 35
2
votes
1 answer

node https-proxy pathRewrite / router

I have two instances of the same node app running on port 3000 and 4000. I would like to have the following behavior: https://localhost/dev ==> http://localhost:3000 https://localhost/prod ==> http:// localhost:4000 I have the following proxy in…
blueren
  • 2,730
  • 4
  • 30
  • 47
2
votes
1 answer

How to use Proxy with puppeteer

I'm new to puppeteer and node, trying to use a proxy with puppeteer in order to collect requests & responses, hopefully also websocket communication, but so far couldn't get anything to work.. I'm trying the following code: const puppeteer =…
Captain_Meow_Meow
  • 2,341
  • 5
  • 31
  • 44
2
votes
1 answer

Modifying the websocket sent message on proxy server

I created a proxy server (node-http-proxy) to redirect websocket connections to another websocket server like: websocket client <-----> proxy <-----> websocket target server In order to control the messages that sent from client to the sever, I…
Conrad
  • 53
  • 2
2
votes
2 answers

Proxying websockets with single "proxyServer" to multiple targets

I am developing a nodeJS websocket proxy server. The use case is when a websocket request comes, I will check its credentials, add new headers and then based on its group (from user id) to redirect the websocket connection to its target webscoket…
Conrad
  • 53
  • 2
2
votes
1 answer

why req.body is undefined in 'proxyRes'

Below is my code import { createProxyServer } from 'http-proxy'; import BodyParser from 'body-parser'; const jsonParser = BodyParser.json(); const proxy = createProxyServer({ target: 'http://127.0.0.1:7800', proxyTimeout:…
gkd
  • 853
  • 1
  • 14
  • 31
2
votes
3 answers

node http-proxy: async modification of request body

I need to modify the request body asynchronously. Something along the lines of this: proxy.on('proxyReq', function(proxyReq, req, res, options) { if(req.body) { new Promise(function(resolve){ setTimeout(function() { // wait for the db…
AyKarsi
  • 9,435
  • 10
  • 54
  • 92
2
votes
0 answers

How to forward only specific requests with node-http-proxy?

I want to use node-http-proxy to forward requests only with certain content-type header. Since i want to filter requests, i can't just use forward option of proxy server. My idea is to use proxyReq event and if request satisfies conditions, forward…
Kirill
  • 6,762
  • 4
  • 51
  • 81
2
votes
2 answers

Generating tor controlport password

I am using the tor-request node module and am having problems. I have followed all steps and directions I could find, Ive searched every site online and I've restarted my computer. I cant finish my project and really am struggling. I keep getting…
N. Howey
  • 119
  • 7
2
votes
2 answers

Remove matched `/api` path in Webpack proxy

I have a backend service running at http://localhost:9090/. All calls starting with /api/* should be forwarded to it, without the /api in front of it. So when I call http://localhost:8080/api/my/route it should proxy to…
Narigo
  • 2,979
  • 3
  • 20
  • 31
2
votes
1 answer

How to retrieve POST request body before proxying it

Using connect library on Node, I tried to retrieve request body before proxying it with node-http-proxy. Since Node v4, we have to use some middleware like bodyParser (or just data/end events on request) to retrieve POST request body. Problem is, it…
Blackus
  • 6,883
  • 5
  • 40
  • 51
2
votes
1 answer

NODE.JS: how to proxy to a host with the variable target DEPENDING on the data received in the req?

I need to use the node-http-proxy library to proxy to a host with the variable target DEPENDING on the data received in the req, let's suppose that I need to find a tag and basing on this tag route to a host. My code is: var http =…
profesoralex
  • 417
  • 1
  • 3
  • 10
2
votes
1 answer

Proxy a node server and websocket server under same subdomain with node-http-proxy

This is my proxy setup: var express = require('express'); var vhost = require('vhost'); var proxy = require('http-proxy').createProxyServer(); var app = express(); var server = http.createServer(app); // route api subdomain to port…
m59
  • 43,214
  • 14
  • 119
  • 136