Questions tagged [http-proxy-middleware]

Node.js proxying made simple. Configure proxy middleware with ease for connect, express, browser-sync and many more. Powered by the popular Nodejitsu http-proxy.

176 questions
2
votes
1 answer

Is there something wrong with making an http request in the ngOnInit of a component when using Angular Universal?

I have been running my Angular app via ng serve for development and was not experiencing any errors. When using SSR, however, I get an error in my server log whenever I load a component that makes an http request as part of it's ngOnInit method. Is…
2
votes
1 answer

after using this (http-proxy-middleware) it give me this error in reactjs

i tried to setup my proxy to make react with node it tried to use proxy in package.json in the client but it keep giving me error when i try to use get method so i search for another solution and i found this one using this npm module …
2
votes
0 answers

http-proxy (reverse proxy) server hangs up in a random time

Problem: When I send a request after this log (memory), it shows "socket hang up (connResetException)" error. And the NodeJS server stops working. [1:0x330e8a0] 22724 ms: Mark-sweep 16.4 (25.2) -> 10.6 (29.9) MB, 3.3 / 0.0 ms (+ 0.1 ms in 2…
2
votes
1 answer

Proxying websocket with react-scripts does not work

I have a react web application and i use react-scripts for developpment. I use the proxy to proxy the requests and websockets to a backend. My package.json : { "name": "webapp", "version": "0.1.0", "private": true, "dependencies": { //…
Magus
  • 13,609
  • 2
  • 31
  • 47
2
votes
0 answers

Setting up http-proxy-middleware on a dynamic route

I'm trying to proxy some asset routes where a dynamic part of the path comes from a config file. I had this working using the request library, but I can't quite get it working with http-proxy-middleware. Here's the code that works when I use the…
Samo
  • 7,964
  • 9
  • 53
  • 91
2
votes
1 answer

Modify http proxy request by adding auth token returned from another request

I'm using the http-proxy-middleware (https://github.com/chimurai/http-proxy-middleware#http-proxy-events) to implement a simple proxy (call it my-proxy/) to another REST API (call it /rest-api) that requires the user to pass an auth token in the…
Will
  • 2,538
  • 5
  • 27
  • 47
2
votes
0 answers

http-proxy-middleware is not working in production but in localhost

I used http-proxy-middle for proxying my api domain in order to bypass CORS issue. My code works in localhost, but when it is not working in my live domain. My code is: const proxy = require('http-proxy-middleware'); app.use( '/api', …
2
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…
2
votes
0 answers

http-proxy-middleware: accessing 127.0.0.1 instead of localhost, causing ECONNREFUSED

Using webpack2 to compile on the fly an angular application, I configured devServer this way: proxy: { '/api': { target: 'http://localhost:52163' } } The target of the proxy is a IIS Express server. After upgrading from Visual…
Fabien
  • 489
  • 6
  • 19
2
votes
0 answers

Set up Webpack Browsersync proxy when sitting behind a http proxy

I want to set up a browsersync proxy in order to inject CSS and Javascript to an arbitrary website. However, I started to create a simple proxy with browsersync trying to serve me my _custom.css file. var browserSync =…
Fl0R1D3R
  • 842
  • 2
  • 10
  • 19
1
vote
0 answers

Why doesn't lvh.me work when proxying with http-proxy-middleware

I have a React app created using create-react-app and I'm setting up a custom proxy for the API with this setupProxy.js: const {createProxyMiddleware} = require("http-proxy-middleware"); module.exports = function (app) { app.use("/api",…
pupeno
  • 256,034
  • 114
  • 324
  • 541
1
vote
0 answers

http-proxy-middleware change headers asynchronously

I'm using http-proxy-middleware in NodeJS to proxy a PHP site that does authentication. The PHP site returns a header "saml-user-id". I use this saml-user-id to generate a token which I want to add as cookie. I need to lookup the user in the…
Hendrik Jan
  • 2,493
  • 3
  • 20
  • 41
1
vote
0 answers

Debug createProxyMiddleware pathRewrite

It would be great to know what I did wrong specifically, but short of that I'd love to know how to print out whatever the real path-rewrite actually is. I tried setting DEBUG=express-http-proxy, but didn't get anything helpful. It seems the…
Woodsman
  • 427
  • 4
  • 18
1
vote
2 answers

http-proxy-middleware proxy is not working in React js and Spring Boot project. GET API is return 415 status error

I'm using the http-proxy-middleware middle ware. Content-Type: application/json is must be add in API's headers while execute with postman. I added my API's header configuration in React. I think the error is caused by I dont send headers corrently.…
1
vote
1 answer

Use http-proxy-middleware to forward Express request changing only port

This is for a NodeJS, Express application. I want to take a request coming into a path like https://mycompany.com/cost-recovery -> http://mycompany.com:8447/cost-recovery. I wish to pass all headers, request bodies, etc. over to this forwarded host.…
Woodsman
  • 427
  • 4
  • 18
1 2
3
11 12