> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/integrations/builtin/core-nodes/duaer-nodes-base.webhook/common-issues.md).

# Duaer 里 Webhook 的常见问题

Duaer 里 Webhook 的常见问题：多种请求方法、测试地址和生产环境地址、IP 白名单、路径冲突和返回字符串。
## 同时接收多种请求方法 <a href="#listen-for-multiple-http-methods" id="listen-for-multiple-http-methods"></a>

1. 打开 Webhook 节点的设置，打开 Allow Multiple HTTP Methods。
2. 回到参数，默认接收 GET 和 POST；在 HTTP Methods 里加其它方法。

每种方法各有一个输出，可以分别接不同的后续节点。

## 测试地址和生产环境地址 <a href="#test-url-versus-production-url" id="test-url-versus-production-url"></a>

- 测试地址：点「监听测试事件」后，Duaer 等待 2 分钟，收到的数据显示在编辑器里。
- 生产环境地址：数字组织发布后一直有效，直到取消发布。执行记录里能看到，编辑器里不实时显示。

详见 [Webhook 地址](/zh/integrations/builtin/core-nodes/duaer-nodes-base.webhook.md#webhook-urls)。

## 用 curl 或 HTTP Request 发一次请求 <a href="#send-a-test-request" id="send-a-test-request"></a>

把 <webhook 地址> 换成节点上的地址，方法和节点设置保持一致：

```
curl --request GET <webhook 地址>
curl --request POST <webhook 地址> --data 'key=value'
curl --request GET <webhook 地址> --header 'key: value'
curl --request POST <webhook 地址> --form 'file=@/path/to/file'
```

也可以在另一个数字组织里用 HTTP Request 调用。用测试地址时，先让 Webhook 节点处于监听状态。

## 返回一段字符串 <a href="#send-a-response-of-type-string" id="send-a-response-of-type-string"></a>

1. Response Mode 选 When Last Node Finishes，Response Data 选 First Entry JSON。
2. Options 里加 Property Name，填要返回的字段名，默认是 data。
3. 在最后接一个 Edit Fields，只保留这个字段并填上字符串。

更灵活的做法是 Response Mode 选 Using 'Respond to Webhook' Node，在 Respond to Webhook 节点里直接写返回内容。

## IP(s) Allowlist 里的地址连不上 <a href="#ip-addresses-in-whitelist-are-failing-to-connect" id="ip-addresses-in-whitelist-are-failing-to-connect"></a>

自托管 Duaer 在反向代理后面时，Duaer 看到的是代理的地址。把 DUAER_PROXY_HOPS 设成代理的层数，Duaer 才会按真实来源地址判断。

## 同一路径和方法只能有一个 Webhook <a href="#only-one-webhook-per-path-and-method" id="only-one-webhook-per-path-and-method"></a>

Duaer 不允许两个已发布的 Webhook 使用同一路径和同一方法，否则提示「There is a conflict with one of the webhooks.」取消发布冲突的那个数字组织，或者改其中一个的路径或方法。
## Questions

### Duaer 的 Webhook 测试地址能监听多久？

Duaer 在你点「监听测试事件」后等待 2 分钟。正式使用请发布数字组织并调用生产环境地址。

### 为什么 Duaer 的生产环境地址调用后编辑器里看不到数据？

Duaer 的生产环境地址调用记在执行记录里，不在编辑器里实时显示。打开执行列表查看那一次运行。

