function ssrfSafeLookupOrProxy(db, url) {
  // If there is an HTTP proxy, then it will have to do the work of blacklisting IPs, because it's
  // the proxy that does the DNS lookup.
  const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
  const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;

  if (httpProxy && url.startsWith("http:")) {
    return { proxy: httpProxy };
  } else if (httpsProxy && url.startsWith("https:")) {
    return { proxy: httpsProxy };
  } else {
    return ssrfSafeLookup(db, url);
  }
}
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.