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
15
votes
3 answers

How to HTTP proxy for Next.js API requests

I have tried lots of things online but nothing is working so far. First try (src/pages/api/proxy/[...slug].js): import { createProxyMiddleware } from 'http-proxy-middleware'; // Create proxy instance outside of request handler function to avoid…
user15517565
15
votes
3 answers

Use angular-cli with multiple path proxy matching

How can I define multiple paths to proxy in my proxy.conf.json? The angular-cli proxy documentation on github looks like you can only have one path (/api): { "/api": { "target": "http://localhost:3000", "secure": false } } But when I…
Hans
  • 681
  • 1
  • 9
  • 22
13
votes
2 answers

How to enable and view create-react-app proxy logs?

How can I view detailed logs of all requests and responses being handled by the proxy used by create-react-app? I don't only want to log some endpoints. Instead, I want to see everything, in as much detail as possible, about what's going through the…
12
votes
4 answers

Proxied requests other than GET are hanging with NestJS and http-proxy-middleware

Example code is available on https://github.com/baumgarb/reverse-proxy-demo The README.md explains how you can re-produce the issue if you clone the repo. I have an API Gateway and a downstream service which returns todos (TodosAPI). A client goes…
baumgarb
  • 1,955
  • 3
  • 19
  • 30
12
votes
2 answers

Log request/responses bodies with http-proxy-middleware

I'm using http-proxy-middleware to implement a transparent proxy. I'd like to do request/response inspection. I mean, I'd like to print in a text file request/responses that go through the proxy whithout do any modifying on them. Up to now, what…
fgalan
  • 11,732
  • 9
  • 46
  • 89
10
votes
3 answers

Create React App http-proxy-middleware not working

So I've set up my proxies on my create-react-app application using http-proxy-middleware. I'm sure I've followed the instructions to the letter, but I keep getting a 404 every time I try to click the relevant link. I'm using create-react-app…
Chris
  • 1,863
  • 5
  • 30
  • 43
9
votes
1 answer

CRA 2.0 How to setup proxy in React?

In CRA 2.0 proxy property on the package.json does not work. After some research, I came across an article suggesting to use http-proxy-middleware. I created an setupProxy.js in the src of my client folder(React side). That contains the following…
Unity Hour
  • 550
  • 2
  • 7
  • 22
8
votes
1 answer

How to proxy to many different targets using http-proxy-middleware?

In the http-proxy-middleware library, the documentation states that you can use the target option to specify where you would like to proxy the request. However, they also allow you to use the router option to specify a function that will be used to…
Matt Hintzke
  • 7,744
  • 16
  • 55
  • 113
7
votes
3 answers

How do you configure a Webpack dev server to serve a specific folder while running the rest of the site through a different server?

Some quick background: My company's site runs off a CMS with the CMS handling all routing. There are no html files, only razor files (.cshtml). While redoing the site from scratch is what I'd prefer to do, it's not an option, so I'm attempting to…
5
votes
1 answer

How do I get webpack devServer to output proxy debug info to the console?

I understand that webpack 5 uses http-proxy-middleware to proxy http requests but I'm trying to setup up a dev server and struggling to debug why my proxy doesn't work because I can't see any logs of what is happening, good or…
5
votes
3 answers

Set up proxy server with multiple targets?

I have 2 express servers: api1 api2 Both are accessed locally using: http://localhost:3000/news http://localhost:3001/stock My aim: Access both express servers endpoints from a Proxy server on http://localhost:8008 My Issue: I can only hit the…
cgd
  • 87
  • 1
  • 6
5
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 …
mohamed nageh
  • 593
  • 4
  • 9
  • 26
5
votes
2 answers

Does http-proxy-middleware work with Serverless Lambda?

I'm trying to proxy an external API through Serverless Lambda. Trying the following example for the code below: http://localhost:3000/users/1 returns 200 but body is empty. I must be overlooking something as http://localhost:3000/users/11 returns a…
5
votes
2 answers

How to set 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
  • 8,202
  • 13
  • 58
  • 95
5
votes
1 answer

NodeJS - Edit and proxy a multipart/form-data request

I have a microservice that proxies every request adding one more field to it. With normal requests it's very easy, just add the field in the request.body and properly set the headers but for multipart/form-data requests I'm in trouble since days…
1
2 3
16 17