0

I have created this project where I need to get information from a server. I have used the createProxyMiddleware from http-proxy-middleware for many months in this project without any problem. But today it just stopped working and I din't change anything to the proxy.

Here is the code in the setupProxy.js file. The process.env.REACT_APP_GEOSERVER_MAPEO_API variable is a variable that contains the endpoint:

const { createProxyMiddleware } = require("http-proxy-middleware");

module.exports = function (app) {
  console.log("test");
  app.use(
    "/geoserver",
    createProxyMiddleware({
      target: process.env.REACT_APP_GEOSERVER_MAPEO_API,
      changeOrigin: true,
    })
  );
};

I also added a console.log("test") to see if the function gets executed but it never does. I also have done a git checkout to a previous version of my code where I am certain the connection worked but also in those versions it doesn't work. So I am certain that i haven't changed any code which may influence the proxy.

Stephen
  • 913
  • 3
  • 24
  • 50
  • Check in termnial by executing `printenv REACT_APP_GEOSERVER_MAPEO_API`. If that value doesn't exist then set it by `export REACT_APP_GEOSERVER_MAPEO_API=your_value` – Meet Zaveri Aug 14 '20 at 11:54
  • The variable exists. The middelware function just never gets called. – Stephen Aug 14 '20 at 11:58

0 Answers0