Deploying a Proxy Stack for API Access from Isolated Networks
Developers building Telegram bots or integrating with international APIs often face timeouts and unstable connections in restricted regions. A proxy server selectively routes requests without funneling all traffic through a VPN. This ensures reliable HTTP, HTTPS, SOCKS, and Telegram MTProto connections with minimal latency.
You can either purchase a ready-made proxy or deploy your own on a VPS. For a quick setup, the proxyctl CLI tool automates the installation of a stack built on 3proxy (HTTP/SOCKS5) and mtg (MTProto).
Proxy vs. VPN: Key Differences
A VPN routes all server traffic, which is overkill for API-specific tasks. A proxy operates selectively:
- Only targeted requests are routed through the intermediary.
- Traffic is segmented by application and user.
- Lower bandwidth overhead and reduced latency.
Proxies don’t replace HTTPS encryption—request security remains handled at the client and server levels.
Protocols in the proxyctl Stack
HTTP Proxy
Handles HTTPS via the CONNECT method. Ideal for:
curl,fetch, andaxios.- Web browsers and standard HTTP clients.
- General web traffic.
SOCKS5 Proxy
A universal TCP relay supporting:
- SOCKS-compatible applications.
- Custom or non-standard protocols.
- Any TCP-based connection.
MTProto Proxy
Designed specifically for Telegram clients. Seamlessly integrates with both mobile and desktop apps.
The stack runs in systemd mode for standard VPS environments or in process mode for systemd-less containers.
Quick Deployment on Ubuntu/Debian
Requires an Ubuntu or Debian VPS. Install the CLI:
curl -fsSL "https://raw.githubusercontent.com/Kotelnikovekb/proxyctl/main/install.sh" | sudo bash
Verify the installation:
proxyctl status
proxyctl diagnose
The diagnostic tool checks if 3proxy is running, verifies port availability, runs local HTTP/HTTPS/SOCKS tests, and validates the user database.
Available installation presets:
proxyctl install full— complete stack (HTTP + SOCKS5 + MTProto).proxyctl install api— HTTP + SOCKS5 for API access.proxyctl install mtproto— Telegram-only setup.proxyctl wizard— interactive configuration.
Combine presets: proxyctl install api mtproto.
User Management & Access Control
3proxy requires authentication. Use these commands:
proxyctl add-user alice— create a new user.proxyctl list-users— view all users.proxyctl change-password alice newpass— update a password.proxyctl remove-user alice— delete a user.
Changes take effect after restarting the service. Retrieve connection details:
proxyctl show-connect— host, port, and username for HTTP/SOCKS5.proxyctl show-telegram-link— generates atg://link for Telegram.
Firewall Configuration & Ports
Essential TCP ports:
3128— HTTP.1080— SOCKS5.443— MTProto.
For Google Cloud: proxyctl print-gcp-firewall outputs ready-to-use gcloud commands. External connection issues usually stem from the provider’s security groups or firewall rules.
Limitations & Use Cases
proxyctl is optimized for Ubuntu/Debian systems using apt. It doesn’t replace a full network infrastructure—you’ll still need to configure your firewall manually.
Best suited for:
- Bot development and third-party API integrations.
- Testing in restricted or isolated network environments.
- Mid-to-senior developers who need reliable access without unnecessary overhead.
Key Takeaways:
- Proxies route specific requests to minimize latency.
- Stack: 3proxy + mtg managed via a unified CLI.
- Ready-made presets for API, Telegram, or full-stack deployments.
- Built-in diagnostics and authentication.
- Manual cloud firewall configuration is required.
— Editorial Team
No comments yet.