docs: function sendXHR(req, config, ip, reversePrefix, cb) {
      let res = {};
      let vid;
      if (!config.FIRST_PARTY_ENABLED || !config.FIRST_PARTY_XHR_ENABLED) {
          if (req.originalUrl.toLowerCase().includes('gif')) {
              res = {
                  status: 200,
                  header: {key: 'Content-Type', value:'image/gif'},
                  body: Buffer.from(config.EMPTY_GIF_B64, 'base64')
              };
          } else {
              res = {
                  status: 200,
                  header: {key: 'Content-Type', value:'application/json'},
                  body: {}
              };
          }
          return cb(null, res);
      }
  
      // handle proxy
      parseBody(req, config.logger).then(() => {
          const searchMask = `/${reversePrefix}${config.FIRST_PARTY_XHR_PATH}`;
          const regEx = new RegExp(searchMask, 'ig');
          const pxRequestUri = req.originalUrl.replace(regEx, '');
          config.logger.debug(`Forwarding request from ${req.originalUrl} to xhr at ${config.COLLECTOR_HOST}${pxRequestUri}`);
  
          const callData = {
              url: `https://${config.COLLECTOR_HOST}${pxRequestUri}`,
              headers: pxUtil.generateProxyHeaders(req.headers, req.ip, config.SENSITIVE_HEADERS, config.FORWARDED_FOR_HEADER),
              timeout: config.API_TIMEOUT_MS
          };
  
          callData.headers['host'] = config.COLLECTOR_HOST;
          callData.headers[config.ENFORCER_TRUE_IP_HEADER] = ip;
          callData.headers[config.FIRST_PARTY_HEADER] = 1;
          if (req.rawBody) {
              callData.headers['content-length'] = Buffer.byteLength(req.rawBody); // makes sure the length of the body is correct, as the body might go trough different body parsers.
              callData.data = req.rawBody;
          }
  
          // handle vid cookies
          if (req.cookies) {
              if (req.cookies['_pxvid']) {
                  vid = req.cookies['_pxvid'];
              } else if (req.cookies['pxvid']) {
                  vid = req.cookies['pxvid'];
              }
  
              if (vid) {
                  if (callData.headers['cookie']) {
                      callData.headers['cookie'] += `; pxvid=${vid}`;
                  } else {
                      callData.headers['cookie'] = `pxvid=${vid}`;
                  }
              }
          }
  
          if (req.method === 'POST') {
              request.post(callData, config, (error, response) => {
                  if (error || !response || response.statusCode >= 400) {
                      if (req.originalUrl.toLowerCase().includes('/beacon')) {
                          res = {
                              status: 200,
                              body: ''
                          };
                      } else {
                          res = {
                              status: 200,
                              header: {key: 'Content-Type', value:'application/json'},
                              body: {}
                          };
                      }
                  } else {
                      res = {
                          status: response.statusCode,
                          headers: response.headers,
                          body: response.body || ''
                      };
                  }
                  return cb(null, res);
              });
          } else if (req.method === 'GET') {
              request.get(callData, config, (error, response) => {
                  if (error || !response || response.statusCode >= 400) {
                      if (req.originalUrl.toLowerCase().includes('.gif')) {
                          res = {
                              status: 200,
                              header: {key: 'Content-Type', value:'image/gif'},
                              body: Buffer.from(config.EMPTY_GIF_B64, 'base64')
                          };
                      } else {
                          res = {
                              status: 200,
                              body: ''
                          };
                      }
                  } else {
                      res = {
                          status: response.statusCode,
                          headers: response.headers,
                          body: response.body || ''
                      };
                  }
                  return cb(null, res);
              });
          }
          return;
      });
  }