Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CompositeClient behind a proxy #309

Open
QuantumTaskForce opened this issue Dec 27, 2024 · 2 comments
Open

Use CompositeClient behind a proxy #309

QuantumTaskForce opened this issue Dec 27, 2024 · 2 comments

Comments

@QuantumTaskForce
Copy link

Hi,
It seems the CompositeClient relies on Tendermint which relies on Axios. Since I am behind a proxy my http requests are blocked, is there a way to use the CompositeClient behind a proxy?
Thanks

Copy link

linear bot commented Dec 27, 2024

@QuantumTaskForce
Copy link
Author

QuantumTaskForce commented Jan 29, 2025

For anyone interested, I found a way to use the proxy. First I override the client's axios dependency in my package.json in order to tell it to use "my" axios

"overrides": {
	"@dydxprotocol/v4-client-js": {
		"axios": "$axios",
	}
}

Next, in my app I change the axios.defaults.httpsAgent field and feed it my proxy parameters. Since the client shares the same axios dependency than my app it is now routed through the proxy.

import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';
const httpsAgent = new HttpsProxyAgent('http://my-proxy.com:1234');
axios.defaults.httpsAgent = httpsAgent;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant