-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
fix(proxy) - explanations #22348
fix(proxy) - explanations #22348
Conversation
ts/src/base/Exchange.ts
Outdated
@@ -1043,6 +1043,10 @@ export default class Exchange { | |||
|
|||
setProxyAgents (httpProxy, httpsProxy, socksProxy) { | |||
let chosenAgent = undefined; | |||
// in browser-side, proxy modules are not supported in 'fetch/ws' methods | |||
if (!isNode && (httpProxy || httpsProxy || socksProxy)) { | |||
throw new NotSupported (this.id + ' - proxies in browser-side projects are not supported. You have several choices: [A] Use `exchange.proxyUrl` property to redirect through local/remote cors-proxy snippet (find sample file named "sample-local-proxy-server-with-cors" in https://github.com/ccxt/ccxt/tree/master/examples/ folder, which includes sample for REST requests) [B] override `exchange.fetch` && `exchange.watch` methods to send request through your custom setup local/remote corst proxy server'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
property to redirect through local/remote cors-proxy snippet
this sentence does not make sense, what is snippet here? we should replace it with server or just remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, it should have been 'server' not 'snippet'. edited
* fix(proxy) - explanation to users * minor * minor * Update Exchange.ts [ci skip]
* fix(proxy) - explanation to users * minor * minor * Update Exchange.ts
* fix(proxy) - explanation to users * minor * minor * Update Exchange.ts [ci skip]
last comment fix #20686
Users should be aware that from browser-side JS, they can't use proxies (because proxy modules rely on 'net & http' native nodejs modules and there does not exist browser-side support for JS proxy functionality yet).