title: How to pass Corporate proxy headers to http-proxy-middleware npm
body: <p>I have a code to call proxy api from Angular using express server.
  While using the following code I'm getting error as can't set header after they sent.
  am I doing something wrong here?</p>
  <pre><code>const {createProxyMiddleware} = require('http-proxy-middleware');
  const HttpsProxyAgent = require('https-proxy-agent');
  const proxyServer = 'http://xyz:port';
  const proxyOptions = {
      target: targetUrl, // target host
      pathRewrite: function(path) {
         return path.replace('/api', '')
      },
      changeOrigin: true,
      secure: false,
      onProxyReq: function(proxyReq, req, res) {
          const accessToken = req.accessToken.rawToken;
          console.log(&quot;identityAccessToken&quot;, identityAccessToken);
          proxyReq.setHeader('Authorization', `Bearer ${identityAccessToken}`);
      },
      agent: new HttpsProxyAgent(proxyServer)
  
   }
  </code></pre>
  <p>thanks in advance.</p>