function sanitizeHeaders(options) {
  
  const HEADERS_TO_IGNORE = ["cookie", "authorization"];

  const urlObject = url.parse(options.url)
  const queryObject = querystring.parse(urlObject.query);
  
  const hasExternalLink = Object.keys(queryObject).reduce(function(acc, cur) {
    
    let qUrl = url.parse(queryObject[cur]);

    // external link if protocol || host || port is different
    if(!!qUrl.host && (qUrl.protocol !== urlObject.protocol || qUrl.host !== urlObject.host || qUrl.port !== urlObject.port) ) {
      acc = true;
    }
    
    return acc;

  }, false);

  if (hasExternalLink && options.hasOwnProperty("headers") && typeof(options.headers) === "object") {
    
    // if External Link: remove Cookie and Authorization from Headers
    Object.keys(options.headers).filter(function(key) {
      return HEADERS_TO_IGNORE.includes(key.toLowerCase())
    }).map(function(key) {
      return delete options.headers[key]
    });

  }

  return options;
}