I'm building a typescript app that relies on DyDx v4-client as a Node module 1 that itself relies on Axios to make HTTP requests.
I'm behind a corporate proxy and Axios cannot make any requests.
For example, when trying to GET https://indexer.v4testnet.dydx.exchange/v4/time the output is Error: getaddrinfo ENOTFOUND. But it works from a web browser so I know it's not blocked by the corporate firewall.
Since Axios is kind of "buried" as a module of DyDx (which is itself a module) I don't have direct explicit access to it in my code. So I tried to directly modify the request function in the compiled JS file to manually add my proxy parameters:
function request(url, method, body, headers) {
return axiosRequest({
url,
method,
data: body,
headers,
proxy: {
protocol: 'http',
host: 'foo.bar',
port: 1234
}
});
Doing this Axios throws me the following error as an HTML page. This page is generated by the firewall. It's like the firewall interpreted the Axios call as a browser call...
Handshake failed
The SSL handshake could not be performed.
Host: service.iwanttoaccess.com
Reason: Can't initialize server context:handshakefailed:server state 1:state 9:Application response 500 handshakefailed
How do I properly set my proxy parameters when I don't have direct access to Axios?
axiosmodule copy as another module uses, you can change axios.defaults. And if you can't import it because of how your app is organized, you're out of luckaxiosmodule of the DyDx module withimport axios, { Axios, AxiosProxyConfig } from '@dydxprotocol/v4-client-js/node_modules/axios';And then add my proxy parameters inaxios.defaultsbut I don't know why it doesn't work.