proxy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNo MCP? The CLI has full feature parity — useinstead ofhelpmetest proxy start/stop/list. See the CLI reference.helpmetest_proxy({...})
没有MCP? CLI的功能完全一致——使用代替helpmetest proxy start/stop/list。请查看CLI参考。helpmetest_proxy({...})
HelpMeTest Proxy Setup
HelpMeTest 代理设置
Sets up proxy tunnels to test local development servers through HelpMeTest.
通过HelpMeTest搭建代理隧道,用于测试本地开发服务器。
How It Works
工作原理
HelpMeTest tests run on remote infrastructure. Your local dev server (localhost:3000) is not reachable from there. The proxy creates a TCP tunnel:
- You start a proxy via the MCP tool — it registers a tunnel with the proxy server and spawns an frpc process
- The tunnel maps a domain (e.g. ) to your local port
dev.local - HelpMeTest's test runner routes traffic for that domain through the tunnel back to your machine
- Your local server responds as if accessed directly
The proxied URL (e.g. http://dev.local) is NOT accessible from your local browser or curl. It only works inside HelpMeTest test commands (, , etc.).
Go Tohelpmetest_run_interactive_commandHelpMeTest的测试运行在远程基础设施上,你的本地开发服务器(localhost:3000)无法从外部访问,代理会创建一个TCP隧道:
- 你通过MCP工具启动代理——它会在代理服务器上注册一个隧道,并启动一个frpc进程
- 隧道会将一个域名(例如)映射到你的本地端口
dev.local - HelpMeTest的测试运行器会将该域名的流量通过隧道路由回你的机器
- 你的本地服务器响应请求,就像被直接访问一样
**代理后的URL(例如http://dev.local)无法从你的本地浏览器或curl访问**,它仅在HelpMeTest的测试命令(`Go Tohelpmetest_run_interactive_command`等)中生效。
、When to Use
适用场景
- Testing against localhost during development
- Substituting production URLs with local versions
- Routing frontend and backend on different ports
- Before writing or running any local tests
- 开发过程中针对本地主机测试
- 将生产URL替换为本地版本
- 路由运行在不同端口的前端和后端服务
- 编写或运行任何本地测试之前
Quick Start
快速开始
Start a proxy:
helpmetest_proxy({ action: "start", domain: "dev.local", sourcePort: 3000 })Verify it works (use HelpMeTest, NOT curl):
helpmetest_run_interactive_command({ command: "Go To http://dev.local" })Should load your local app. If it doesn't, fix the proxy before writing tests.
Check active proxies:
helpmetest_proxy({ action: "list" })Stop a proxy:
helpmetest_proxy({ action: "stop", domain: "dev.local" })启动代理:
helpmetest_proxy({ action: "start", domain: "dev.local", sourcePort: 3000 })验证生效(使用HelpMeTest,不要用curl):
helpmetest_run_interactive_command({ command: "Go To http://dev.local" })应该会加载你的本地应用,如果没有加载成功,请先修复代理问题再编写测试。
查看活跃代理:
helpmetest_proxy({ action: "list" })停止代理:
helpmetest_proxy({ action: "stop", domain: "dev.local" })Three Proxy Strategies
三种代理策略
Strategy 1: Single Tunnel to Frontend
策略1:单隧道连接前端
When: Your dev server already proxies some routes internally (e.g., Vite's sends to backend port)
server.proxy/apihelpmetest_proxy({ action: "start", domain: "dev.local", sourcePort: 5001 })Tests use — both UI and API calls work through one tunnel.
http://dev.local适用场景: 你的开发服务器已经在内部代理了部分路由(比如Vite的将请求转发到后端端口)
server.proxy/apihelpmetest_proxy({ action: "start", domain: "dev.local", sourcePort: 5001 })测试使用——UI和API请求都可以通过一个隧道正常工作。
http://dev.localStrategy 2: Separate Tunnels for Frontend and Backend
策略2:前后端分离隧道
When: Services need different hostnames (cookies, CORS), or no internal proxy configured.
helpmetest_proxy({ action: "start", domain: "frontend.local", sourcePort: 5001 })
helpmetest_proxy({ action: "start", domain: "backend.local", sourcePort: 3001 })Tests use for UI and for API.
http://frontend.localhttp://backend.local适用场景: 服务需要不同的主机名(cookie、CORS场景),或者没有配置内部代理。
helpmetest_proxy({ action: "start", domain: "frontend.local", sourcePort: 5001 })
helpmetest_proxy({ action: "start", domain: "backend.local", sourcePort: 3001 })测试使用访问UI,访问API。
http://frontend.localhttp://backend.localStrategy 3: Substitute Production with Local
策略3:将生产地址替换为本地地址
When: You have tests running against production URLs and want to test local changes without modifying test code.
helpmetest_proxy({ action: "start", domain: "my.awesome.app", sourcePort: 3000, externalPort: 80 })Tests use — routes to localhost:3000 instead of production.
http://my.awesome.appPort mapping:
- — hostname in test URLs
domain - — port in test URLs (default 80 for HTTP)
externalPort - — your local development port
sourcePort
适用场景: 你有针对生产URL运行的测试,想要在不修改测试代码的情况下测试本地改动。
helpmetest_proxy({ action: "start", domain: "my.awesome.app", sourcePort: 3000, externalPort: 80 })测试使用——会路由到localhost:3000而不是生产环境。
http://my.awesome.app端口映射说明:
- —— 测试URL中的主机名
domain - —— 测试URL中的端口(HTTP默认是80)
externalPort - —— 你的本地开发端口
sourcePort
WebSocket Support
WebSocket支持
- (TLS WebSocket) works through the tunnel via CONNECT
wss:// - (plain WebSocket) does NOT work — browsers block non-TLS WebSocket through HTTP proxy
ws://
If your app uses WebSocket, make sure it connects over .
wss://- (TLS加密WebSocket)可以通过CONNECT方式通过隧道正常工作
wss:// - (明文WebSocket)无法工作——浏览器会阻止通过HTTP代理的非TLS WebSocket请求
ws://
如果你的应用使用WebSocket,请确保它通过连接。
wss://Verification
验证
After starting a proxy, always verify using HelpMeTest interactive commands:
helpmetest_run_interactive_command({ command: "Go To http://dev.local" })Expected: Your local app loads successfully. If you see or a connection error, the proxy is not working — fix it before writing tests.
chrome-error://chromewebdata/Do NOT try to verify with curl or your local browser — the proxy only works inside HelpMeTest's infrastructure.
启动代理后,请始终使用HelpMeTest交互式命令验证:
helpmetest_run_interactive_command({ command: "Go To http://dev.local" })预期结果:你的本地应用成功加载。如果你看到或者连接错误,说明代理没有正常工作——请先修复问题再编写测试。
chrome-error://chromewebdata/不要尝试用curl或本地浏览器验证——代理仅在HelpMeTest的基础设施内部生效。
Troubleshooting
故障排查
Tests show chrome-error or connection refused
测试显示chrome错误或连接被拒绝
- Check proxy is running:
helpmetest_proxy({ action: "list" }) - Check local server is running: (this works locally)
curl http://127.0.0.1:3000 - Restart proxy if needed: Stop and start again
- 检查代理是否正在运行:
helpmetest_proxy({ action: "list" }) - 检查本地服务器是否正在运行: (该命令在本地应该正常工作)
curl http://127.0.0.1:3000 - 必要时重启代理: 先停止再重新启动
Stale frpc processes blocking new proxy
陈旧的frpc进程阻塞新代理
If starting a proxy fails with "proxy already exists":
- A previous frpc process may still be running with the same name
- Stop the proxy first:
helpmetest_proxy({ action: "stop", domain: "dev.local" }) - Or stop all:
helpmetest_proxy({ action: "stop_all" }) - If MCP-managed stop doesn't work, check for orphaned frpc processes:
ps aux | grep frpc
如果启动代理失败并提示“proxy already exists”:
- 之前的frpc进程可能仍在使用相同名称运行
- 先停止代理:
helpmetest_proxy({ action: "stop", domain: "dev.local" }) - 或者停止所有代理:
helpmetest_proxy({ action: "stop_all" }) - 如果MCP管理的停止命令无效,请查找孤立的frpc进程:
ps aux | grep frpc
MCP tool shows old output format
MCP工具显示旧输出格式
If the proxy tool output looks different from what's documented here, the MCP server may be running old code. Restart the MCP server with .
/mcp如果代理工具的输出和本文档描述的不同,说明MCP服务器可能运行的是旧版本代码。使用命令重启MCP服务器。
/mcpCustom hostname not resolving
自定义主机名无法解析
Custom hostnames (like ) are handled entirely by the proxy — no edits needed. If verification fails:
frontend.local/etc/hosts- Verify proxy is running with action
list - Make sure you're using HTTP (not HTTPS) unless you have TLS configured
- Check the exact domain matches what you used in
start
自定义主机名(比如)完全由代理处理——不需要修改文件。如果验证失败:
frontend.local/etc/hosts- 使用操作验证代理正在运行
list - 确保你使用的是HTTP(不是HTTPS),除非你已经配置了TLS
- 检查使用的域名和你操作中填写的域名完全一致
start
Multiple Services Example
多服务示例
undefinedundefinedLocal frontend on port 5001
Local frontend on port 5001
helpmetest_proxy({ action: "start", domain: "frontend.local", sourcePort: 5001 })
helpmetest_proxy({ action: "start", domain: "frontend.local", sourcePort: 5001 })
Local backend API on port 3001
Local backend API on port 3001
helpmetest_proxy({ action: "start", domain: "api.local", sourcePort: 3001 })
helpmetest_proxy({ action: "start", domain: "api.local", sourcePort: 3001 })
Production service running locally on port 8000
Production service running locally on port 8000
helpmetest_proxy({ action: "start", domain: "prod.myapp.com", sourcePort: 8000, externalPort: 80 })
Tests can now use all three domains inside HelpMeTest commands.helpmetest_proxy({ action: "start", domain: "prod.myapp.com", sourcePort: 8000, externalPort: 80 })
现在测试可以在HelpMeTest命令中使用这三个域名。Best Practices
最佳实践
- Start proxy BEFORE writing tests — don't debug test failures caused by missing proxy
- Always verify with HelpMeTest — use interactive commands, not curl or browser
- Choose simplest strategy — if frontend already proxies backend, use Strategy 1
- Use consistent domains — if you use in one test, use it in all tests for that service
frontend.local - Stop proxies when done — cleans up everything
stop_all
Version: 0.2
- 在编写测试之前启动代理——不要调试因为代理缺失导致的测试失败
- 始终使用HelpMeTest验证——使用交互式命令,不要用curl或浏览器
- 选择最简单的策略——如果前端已经代理了后端,使用策略1
- 使用一致的域名——如果你在一个测试中使用,该服务的所有测试都应该使用同一个域名
frontend.local - 使用完后停止代理——可以清理所有代理
stop_all
版本: 0.2