# n8n

n8n 是工作流自动化工具，其 HTTP Request 节点按请求接受代理。适合做低代码的抓取、监控、Web 服务回调，通过 helodata 转发。

## HTTP Request 节点

1. 拖入 **HTTP Request** 节点。
2. **Settings → Proxy**（齿轮图标下）。
3. 填写：

### 住宅 / 移动（网关型）

| 字段        | 值                                                                           |
| --------- | --------------------------------------------------------------------------- |
| Proxy URL | `http://helo_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.helodata.io:7777` |

### ISP

| 字段        | 值                                                     |
| --------- | ----------------------------------------------------- |
| Proxy URL | `http://helo_s1a2b3c4d5e:PASSWORD@198.51.100.42:8000` |

4. **Save → Execute Node** 测试。

\[screenshot: n8n HTTP Request 节点的 Proxy URL 字段]

## 通过环境变量给整个工作流配代理

让 n8n 进程本身继承代理（所有 HTTP 节点自动应用），启动前设环境变量：

```bash
export HTTP_PROXY="http://helo_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.helodata.io:7777"
export HTTPS_PROXY="$HTTP_PROXY"
n8n start
```

n8n 底层 axios/HTTP 层识别这些变量。

## 跨执行轮换 IP

用 n8n 的 **Function** 节点为每次执行生成新会话：

```js
const sid = Math.random().toString(36).slice(2, 10);
const user = `helo_s1a2b3c4d5e-type-res-region-us-session-${sid}-sesstime-10`;
return [{
  json: {
    proxy_url: `http://${user}:PASSWORD@gate.helodata.io:7777`,
  },
}];
```

把 `{{ $json.proxy_url }}` 传给 HTTP Request 节点的 Proxy 字段。

## ISP IP 池

把 ISP 清单放在 **Set** 节点（或从表格/数据库取），用 **Function** 节点挑一行，再喂给 HTTP Request：

```js
const ips = $input.first().json.lines;       // "ip:port:user:pass" 字符串数组
const line = ips[Math.floor(Math.random() * ips.length)];
const [ip, port, user, pass] = line.split(":");
return [{ json: { proxy_url: `http://${user}:${pass}@${ip}:${port}` } }];
```

## 验证

HTTP Request 指向 `https://ipv4.icanhazip.com`，查看响应。

## 常见陷阱

* **自托管 n8n 处于企业代理后** — n8n HTTP 节点不会串联代理，最后设置的代理生效。
* **密码含特殊字符** — URL 编码（`@` → `%40`）。
* **Webhook 触发节点** 不走代理（它接收入站），只有出站 HTTP Request 走。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.helodata.com/helodata-zh/ji-cheng-zhi-nan/ai-yu-gong-zuo-liu/n8n.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
