title: Create React App http-proxy-middleware not working
body: <p>So I've set up my proxies on my <code>create-react-app</code> application using <code>http-proxy-middleware</code>. 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.</p>
  
  <p>I'm using <code>create-react-app</code> v3.2.</p>
  
  <p>Here's my <code>setupProxy.js</code> file:</p>
  
  <pre><code>const proxy = require("http-proxy-middleware");
  
  module.exports = function(app) {
      app.use(proxy("/api", { target: "http://localhost:3090" }));
  };
  </code></pre>
  
  <p>Here's the action creator that makes the <code>http</code> request</p>
  
  <pre><code>export const signIn = formProps =&gt; async dispatch =&gt; {
      try {
          const response = await axios.post("/api/login", formProps);
  
          //.....etc, etc
      } catch(e) {
  
          //.....etc,etc
      }
  }
  </code></pre>
  
  <p>And here's the relevant route on my express server:</p>
  
  <pre><code>app.post("/login", requireSignIn, Authentication.login);
  </code></pre>
  
  <p>When the development server starts up, I get the following message:</p>
  
  <pre><code>[HPM] Proxy created: /api  -&gt; http://localhost:3090
  </code></pre>
  
  <p>So <code>setupProxy.js</code> is obviously being picked up by CRA, but there's something wrong somewhere. I've tried adding wildcards to the proxy setup (e.g. "/api/*") but no luck. I get the following 404 logged in my console on the client side:</p>
  
  <pre><code>POST http://localhost:3000/api/login 404 (Not Found)
  </code></pre>
  
  <p>which refers to <code>localhost:3000</code>, suggesting that the proxy (which should redirect to <code>localhost:3090</code>) is not being used.</p>
  
  <p>I can't help thinking that there's something really simple that I'm missing here, but currently tearing my hair out trying to get this to work.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thanks!</p>