jacktuck / unfurl

Metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js :zap:
MIT License
481 stars 52 forks source link

Posibility to use axios or enhance the current implementation to work on company proxyfied networks #95

Closed PiiXiieeS closed 1 year ago

PiiXiieeS commented 2 years ago

We have not been able to make unfurl work in internal corporate networks behind a proxy. We use regularly axios with https://github.com/TooTallNate/node-https-proxy-agent as http/https proxy agent.

Would you consider a potential transition to axios or to extend the package to make it compliant with both node-fetch and axios? Or eventually extend the current implementation to make it work behind a proxy.

Thanks for your thoughts!

jacktuck commented 2 years ago

90 should allow you to provide your own fetch implementation. I've not tested this but you ought to be able to do something like

const fetch = require('node-fetch');
const HttpsProxyAgent = require('https-proxy-agent');
const proxyAgent = new HttpsProxyAgent('http://someproxy');

await unfurl("https://google.com", {
  fetch: url => fetch(url, { agent: proxyAgent});
})