title: Serve react project on dev througth proxy
body: <p>I've split my react application in 3 different projects, using CRA for all of them, auth, X and Y. User is first sent to auth, then I redirect him to either X or Y based on some info.</p>
  
  <p>It works perfectly on PRODUCTION environment (because they run on the same domain), but on dev, X and Y failed to authenticate the user, because they run on different ports (different domains) the data in local storage is not shared between auth, X and Y.</p>
  
  <p>I've tried to find a way to use a reverse proxy (http-proxy)  to host the React dev servers on the same domain, but failed too, because the services could not find the assets/static folder, resulting in 404. Also tried http-proxy-middleware, as it is recommended on the CRA docs page, but failed to do so. Is there an easier way that I'm not seeing?</p>
  
  <p>Edit: Found something new, but also failed. Used react-rewired to override CRA scripts, to use PUBLIC_PATH on DEV, but now my bundle.js returns an index.html file. </p>
  
  <p>The following code does redirect to the accordingly react project, but the assets are requested to the wrong path.</p>
  
  <pre><code>const apiProxy = httpProxy.createProxyServer();
  
  
  app.all("/login/*", function(req, res) {
      console.log('redirecting to Login');
      apiProxy.web(req, res, {target: servers.login});
  });
  
  app.all("/implementacao/*", function(req, res) {
      console.log('redirecting to Implementation');
      apiProxy.web(req, res, {target: servers.implementation});
  });
  </code></pre>
  
  <p>So I used react-rewired to change the public path</p>
  
  <pre><code>const {
    override,
  } = require('customize-cra');
  
  module.exports = {
    webpack: override(
        (config) =&gt; {
          config.output.publicPath = '/login/';
          return config;
        },
    ),
  
    jest: config =&gt; {
      return config;
    },
  
    devServer: configFunction =&gt; (proxy, allowedHost) =&gt; {
      return configFunction(proxy, allowedHost);
    },
  
    paths: (paths, env) =&gt; {
      return paths;
    }
  };
  </code></pre>
  
  <p>Now, the assets requests are made correctly to /login/, but nothing the dev server always return an index.html file.</p>