1

I am using http-proxy-middleware in my reactApp. Backend is implemented in Springboot . Springboot Webflux is being used to send the Flux data to UI .

When I am directly using

eventSource.onmessage = (event) => {
        console.log(event);
      };

I am able to see the messages. But when I am using

const apiURL = "/test"
eventSource = new EventSource(apiURL);

Then I am not able to see the messages. my setupProxy.js includes

  const proxied =
    pathname.match("^/test") ;
  return proxied;
};


module.exports = function (app) {
  app.use([
    createProxyMiddleware(apiFilter, { target: apiUrlTest, ws: true }),
  ]);
};

Is there any way to resolve it. Why on direct call i m getting messages but when calling through proxy I am not able to view the message.

0 Answers0