Implement regular proxy
Hi, I'd like to use the pkg but I'd like to see the possibility to use a regular proxy as well, not just a CORS proxy.
https://axios-http.com/docs/req_config
This can be done under axios with the proxy field.
As a workaround for now, you can use:
import axios from 'axios';
axios.defaults.proxy = {
host: '127.0.0.1',
port: 9000,
auth: {
username: 'mikeymike',
password: 'rapunz3l'
}
}
for a default proxy (all your axios calls)
Hi, current library is aimed to be unified and extendable, so we can't provide axios-specific features on level of current library, because it would bounds us to a implementation of fetcher.
But i see your concern, you need to use a proxy server like socks or https instead of CORS proxy.
To resolve this problem, we could introduce some option in Translator constructor, to provide a fetcher.
If you use axios, you would create some fetcher class/function with configured proxy details, and then Translator will use provided fetcher implementation to sent requests.
In case you need to run code in browser, you still may provide a wrapped fetch.
What you think about it? Is it would fix your problem?
That would also indeed fix the problem, and would allow me to customize the axios / fetch client further than just the proxy if needed.