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.

241 questions
2
votes
1 answer

How to add user data in http-proxy-middleware

What I pretty much want to achieve is add user data, or any data, into my requests to one of my services but like I did in the code below it is not adding to my proxyRequest when sent to my service. Any one know why and how can I achieve…
2
votes
1 answer

Error occurred while proxying request - CERT_HAS_EXPIRED

After spending some considerable amount of time trying to solve this, here I am seeking some help about this issue. Problem [HPM] Error occurred while proxying request localhost:3000/auth/authentication-api/clinic/user/login to https://xyxyx.clinic/…
2
votes
0 answers

Can not get image from api when using http-proxy-middleware in React.Js

i got cors error and fixed it when using http-proxy-middleware according to video tutorial https://www.youtube.com/watch?v=hxyp_LkKDdk (Skip to solution: 20:08, i have followed and it is like below). everything is fine until i get the picture from…
Four
  • 125
  • 1
  • 1
  • 9
2
votes
1 answer

How to add a URL to the begining of every fetch request in my application?

I have a react app started with CRA, and a backend server set up for my react app. My fetch requests go something like const res = await fetch("/applications", { ... I have set it up my app with a proxy middleware using http-proxy-middleware const…
momomo
  • 319
  • 1
  • 5
  • 15
2
votes
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",…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
2
votes
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
  • 901
  • 21
  • 61
2
votes
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
  • 901
  • 21
  • 61
2
votes
2 answers

60 second timeout in http-proxy-middleware

I am seeing a 60 seconds timeout when using chimurai/http-proxy-middleware in Create-React-App and I cannot understand where it is coming from. I am running an API on port 5000 and configured setupProxy.js as const { createProxyMiddleware } =…
2
votes
1 answer

How to use http-proxy-middleware with react and passport.js

Well,I am working on a react app.I have an express server at localhost:5000 and the react app on localhost:3000.I am going through the google oauth flow using passportjs.Now the real problem is I have used the http-proxy-middleware to go to…
2
votes
1 answer

React http-proxy-middleware proxy not working

Hi I been trying the proxy solution to avoid the cors problems in myapp but it doesn't seem to work, i restarted my machine so many times and that made no difference. Basically myapp using fetchApi to call another domain (localhost:8080) which is a…
2
votes
1 answer

How do I use createProxyMiddleware with the nested logic

/node_modules/http-proxy/lib/http-proxy/index.js:120; Error: socket hang up Previous Post: /node_modules/http-proxy/lib/http-proxy/index.js:120; Error: socket hang up I'm trying to use createProxyMiddleware({ target: serviceProvider}) instead…
2
votes
1 answer

How to set up a proxy in React Native?

In a react app, one creates a setupProxy.js file and puts the following in it: const proxy = require('http-proxy-middleware'); module.exports = function(app) { app.use(proxy('/api/*', { target: 'http://localhost:5000/' } )); } But…
zengod
  • 1,114
  • 13
  • 26
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
  • 14,796
  • 3
  • 36
  • 51
2
votes
1 answer

Proxied websocket connection is immediately closed

I have a create-react-app dev server proxying backend connections (as one does). Suddenly websocket proxying stopped working. My setupProxy.js looks like this: const proxy = require('http-proxy-middleware'); module.exports = function(app) { …
2
votes
1 answer

react import environment in setupProxy.js of http-proxy-middleware generate unexpected identifier

I need to set the target of proxy http-proxy-middleware in react using a variable obtained by craco. I have followed this guide to have more configuration file for different environments. I have 3 files local.js, development.js, and production.js…