Proxies โ
Proxy configuration belongs on the server. Use only networks and exchange access you are authorized to use. A proxy does not change account eligibility or regional restrictions.
REST HTTP proxy โ
Pass Axios proxy settings as the second constructor argument:
ts
import { SpotClient } from '@siebly/htx-api';
export const client = new SpotClient(
{},
{
timeout: 20_000,
proxy: {
protocol: 'http',
host: '127.0.0.1',
port: 8080,
},
},
);This configures REST only, not WebSockets.
Shared HTTPS proxy agent โ
Install the agent dependency:
sh
npm install https-proxy-agentSet PROXY_URL in your private server environment:
ts
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SpotClient, WebsocketClient } from '@siebly/htx-api';
const proxyUrl = process.env.PROXY_URL;
if (!proxyUrl) {
throw new Error('Set PROXY_URL to your HTTP or HTTPS proxy URL.');
}
const agent = new HttpsProxyAgent(proxyUrl);
export const client = new SpotClient(
{
keepAlive: false,
},
{
httpsAgent: agent,
proxy: false,
timeout: 20_000,
},
);
export const ws = new WebsocketClient({
wsOptions: {
agent,
},
});proxy: false disables Axios's separate proxy handling. keepAlive: false prevents the SDK from replacing the custom HTTPS agent. WebSockets receive the agent through wsOptions.
Never print or commit credential-bearing proxy URLs. Node.js agents are not browser or Cloudflare Worker transports.