feat(voice/tts): route ElevenLabs through HTTP proxy for non-RU egress
All checks were successful
Deploy / deploy (push) Successful in 4m3s

ElevenLabs Cloudflare returns 302 to a region-restricted help page
when requested from a Russian IP. Tablet host (.60) is in RU, so the
Stage 2 call was failing with 502 upstream.

Fix: use https-proxy-agent when ELEVENLABS_PROXY (or generic HTTPS_PROXY
/ HTTP_PROXY) env var is set. Tinyproxy on .103 (non-RU egress host)
acts as the tunnel.

- package.json: add https-proxy-agent ^7.0.6
- app/api/voice/tts: switch from global fetch to node:https with
  explicit Agent (either direct or HttpsProxyAgent). Still streams
  MP3 back via Readable.toWeb so Next.js Response pipes it to the
  browser as audio arrives.

Operational: set ELEVENLABS_PROXY=http://192.168.31.103:8888 in
tablet.env after bringing tinyproxy up on .103.
This commit is contained in:
Cosmo
2026-04-23 13:00:55 +00:00
parent a780fc7bd5
commit c29da75c19
3 changed files with 80 additions and 26 deletions

View File

@@ -12,6 +12,7 @@
"clsx": "^2.1.1",
"framer-motion": "^11.1.7",
"googleapis": "^171.4.0",
"https-proxy-agent": "^7.0.6",
"lucide-react": "^0.376.0",
"next": "14.2.3",
"react": "^18",