Questions tagged [node-http-proxy]

A full-featured http proxy for node.js

271 questions
4
votes
4 answers

In nodejs trying to get http-proxy to forward requests passing through query string parameters

How do I proxy requests with query string parameters in nodejs, I am currently using express and http-proxy? I have a nodejs application using express and the http-proxy module to proxy HTTP GET requests from certain paths on my end to a third party…
Encaitar
  • 398
  • 5
  • 16
4
votes
0 answers

Cookie is not set on cross domain

I am making an angularjs cordova apps. To login we must perform to another domain a first request to /login and the the response has an entry called cookie which contains the cookie we must set in order to login. The problem is that when I'm…
Vinz243
  • 9,654
  • 10
  • 42
  • 86
4
votes
2 answers

How to get response time of each proxy-request done by node-http-proxy?

i want to compute the response-time for each proxy-request, done by node-http-proxy, like this: var httpProxy = require('http-proxy'); var proxy = httpProxy.createProxyServer(); require('http').createServer(function(req, res) { // start-time for…
chris
  • 169
  • 2
  • 11
4
votes
1 answer

vhosts with http-proxy and express

I'm trying to emulate virtual hosts on nodeje express with http-proxy code httpProxy.createServer({ hostnameOnly : true, router : { 'secure.domain.com' : '127.0.0.1:9000' } }).listen(8080); (function(){ var app = express(); …
clarkk
  • 27,151
  • 72
  • 200
  • 340
4
votes
1 answer

Proxying WebSockets through node-http-proxy doesn't work

These are the versions of node and required modules I am using: Node.js: 0.10.16 Websocket Library: einaros/ws ws@0.4.28 Proxy server: nodejitsu/node-http-proxy http-proxy@0.10.3 When I run the following program my console output looks like this,…
verma
  • 1,285
  • 1
  • 13
  • 19
4
votes
0 answers

http-proxy forward to a specific path

While trying out http-proxy with node.js, I have the following piece of code: var httpProxy = require('http-proxy'); httpProxy.createServer( require('proxy-by-url')({ '/AAA': { port: 80, host: 'myDomain.com' }, '/BBB': { port: 80, host:…
E. Jaep
  • 2,095
  • 1
  • 30
  • 56
4
votes
2 answers

Default route using node-http-proxy?

I want to do a simple node.js reverse proxy to host multiple Node.JS applications along with my apache server on the same port 80. So I found this example here var http = require('http') , httpProxy =…
Alexandre Blin
  • 270
  • 6
  • 13
3
votes
1 answer

Proxying Websocket requests from https to http in Node.js

I am working on a Node.js proxy server that routes requests from a website to a localhost endpoint. The website can run either locally or on a cloud instance, so the proxy needs to support both HTTP and HTTPS requests and route them to the HTTP…
Clarity
  • 10,730
  • 2
  • 25
  • 35
3
votes
0 answers

Convert express Response to http ServerResponse

I am using both express and http-proxy. After updating NodeJs types I am getting a type error: TS2345: Argument of type 'Response>' is not assignable to parameter of type 'ServerResponse'.   Types of property 'req' are…
fusio
  • 3,595
  • 6
  • 33
  • 47
3
votes
1 answer

How can I pass a proxied response when 'selfHandleResponse' is true?

I am running a development proxy-server where on startup I make a request for an auth token with our cluster architecture. However, this token expires after some time. Then instead of the developer restarting their proxy-server, I would like to make…
3
votes
1 answer

node-http-proxy, how to pass new query parameters to initial request?

I am trying to add new query params to the original request in my node-http-proxy, tweaking the req.query directly like this doesn't work: app.all(path, function (req, res) { req.query.limit = 2; apiProxy.web(req, res, { target: target…
Carlos Valencia
  • 6,499
  • 2
  • 29
  • 44
3
votes
1 answer

NPM vulnerabilities - requires manual review

Whilst starting a new project and running npm install I got a couple of vulnerabilities w.r.t http and https proxy. Running npm audit fix doesn't appear to fix them. I have also tried manually updating to the latest version available such as npm…
Murchie85
  • 815
  • 2
  • 12
  • 27
3
votes
1 answer

Proxy multiple hosts that have same URL patterns

I am using http-proxy-middleware to proxy my API calls How can I proxy multiple target hosts? I have searched through the issue and still could not understand. https://github.com/chimurai/http-proxy-middleware/issues/12 - Allow me to use proxy…
user8839735
3
votes
1 answer

Nodejs: http-proxy redirect to available server

I am using the http-proxy npm module for connecting multiple servers to a single port. I wrote the following code and it's working fine: var http = require('http'); var httpProxy = require('http-proxy'); // Proxy Address var proxyAddresses = [ …
Kalai
  • 113
  • 2
  • 8
3
votes
1 answer

setting proxy or backend URL while doing gulp build:dist

We have some code in Angular JS which is build using gulp (babel). We have necessity to redirect the api service calls to a different server. Hence, which development we run gulp server and with that add the api-host server in the proxy argument…
indranil9286
  • 81
  • 2
  • 10