Questions tagged [node-http-proxy]

A full-featured http proxy for node.js

271 questions
6
votes
1 answer

How to update location in for http call

Im using the reverse proxy from the following link, currently Im getting some location and I want to update it(the location), How can I do that? proxy.on('proxyRes', function (proxyRes, req, res) { res.headers.location = 'http:/a/b/' }); and I…
07_05_GuyT
  • 2,787
  • 14
  • 43
  • 88
6
votes
2 answers

Proxy request to new port with http-proxy

I use this code I want to create proxy that all the application calls to port 3000 will be routed "under the hood" to port 3002 var http = require('http'), httpProxy = require('http-proxy'); var proxy = httpProxy.createProxyServer(); …
John Jerrby
  • 1,683
  • 7
  • 31
  • 68
6
votes
2 answers

Http proxy error for target

I use the following code and it works proxy.web(req, res, { changeOrigin: true, target: 'http://' + hostname + ':' + port, ws: true }); But when I try the following I got…
07_05_GuyT
  • 2,787
  • 14
  • 43
  • 88
6
votes
1 answer

Node.js proxy with ability to change response headers and inject additional request data

I'm writing a node.js proxy server, serving requests to an API on different domain. I'd like to use node-http-proxy and I have already found a way to modify response headers. But is there a way to modify request data on condition (i.e. adding API…
aliona
  • 447
  • 1
  • 6
  • 18
6
votes
3 answers

What is the point of using a proxy server such as node-http-proxy for a node app with a single app on one port?

I'm exploring using the node-http-proxy proxy server so that I can have our proxy server on port 80 forward requests to our app server on port 8000. However, I'm a little confused as to why this is a good idea, and what exactly this set up would…
user730569
  • 3,940
  • 9
  • 42
  • 68
5
votes
3 answers

How can I timeout slow Connect middleware and instead return the Node response?

I have a Node server that uses Connect to insert some middleware which attempt to transform a response stream from node-http-proxy. Occasionally this transformation can be quite slow and it would be preferable in such cases to simply return a…
maxcountryman
  • 1,562
  • 1
  • 24
  • 51
5
votes
2 answers

ng serve --proxy-config with NTLM authentication is not working

I'm trying to get angular cli's internal webserver (webpack uses node-http-proxy I think) to work with NTLM authentication and coming up short. I set up the webpack proxy like this: // in packages.json ... "scripts": { "start": "ng serve…
gatapia
  • 3,574
  • 4
  • 40
  • 48
5
votes
2 answers

Node Http Proxy - basic reverse proxy doesn't work (404s)

I'm trying to get a very simple proxy working with node-http-proxy which I would expect to just return the contents of google: const http = require('http'); const httpProxy = require('http-proxy'); const targetUrl =…
Dominic
  • 62,658
  • 20
  • 139
  • 163
5
votes
0 answers

how to modify message when using node-http-proxy to proxy websocket

ATT. I'm using node-http-proxy to proxy to websocket, but how can I modify message before send to backend websocket server?
atian25
  • 4,166
  • 8
  • 37
  • 60
5
votes
1 answer

Socket.io-based app running through node proxy server disconnecting all sockets whenever one disconnects

I made a basic chat app using node.js, express and socket.io. It's not too different from the tutorial chat app for socket.io, it simply emits events between connected clients. When I ran it on port 3001 on my server, it worked fine. Then I made a…
Danneh
  • 201
  • 4
  • 10
5
votes
1 answer

nodejs: routing table using http-proxy

Trying to put in place an http proxy with a custom routing logic using http-proxy 1.4.3, following this tuto and executing the code below: var httpProxy = require("http-proxy"); var url = require("url"); httpProxy.createServer(function(req, res,…
MaK
  • 596
  • 4
  • 23
5
votes
2 answers

http-proxy keeps returning 404

I'm trying to proxy calls to a REST API using http-proxy, but it keeps returning 404 codes. This is an example call to my API: http://petrpavlik.apiary-mock.com/notes It returns some JSON data. This is what my server code looks like: var httpProxy =…
Petr Pavlík
  • 178
  • 1
  • 10
5
votes
2 answers

Node.js HTTP Proxy modify body

I want to program Node.js http proxy that will be able to modify response body. I have done this so far: http = require('http'), httpProxy = require('http-proxy'); var proxy = httpProxy.createProxyServer(); http.createServer( function (req, res){ …
Jakub Tětek
  • 161
  • 1
  • 1
  • 7
5
votes
1 answer

node.js http-proxy how to set timeout and a handler on request

I am using http-proxy on node.js. I have a proxy request to another server. my requirement is that the proxy request should timeout in 10 seconds. Also when the time out happens, I should be able to display a custom message to user I have the below…
Srijit
  • 475
  • 7
  • 30
5
votes
1 answer

How to enable HSTS with node-http-proxy?

Under node.js 0.8, I'm using node-http-proxy in "router table" mode configured like so: var httpProxy = require("http-proxy"); var config = require("./config"); proxyServer = httpProxy.createServer({ hostnameOnly: true, router: { …
user85461
  • 6,510
  • 2
  • 34
  • 40
1 2
3
18 19