我正在Django服务器上工作,该服务器应该通过webhook帖子验证付款。当我在开发模式下生成服务器并使用ngrok进行隧道传输时,我不会收到传入的webhook。我已经使用webhook.site验证了支付服务确实发送了webhook,因此问题似乎是我的ngrok服务不允许流量通过。我的ngrok是使用启动的
./ngrok http -region=eu 8000
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account JianDk (Plan: Free)
Version 2.3.40
Region Europe (eu)
Web Interface http://127.0.0.1:4040
Forwarding http://20e8-94-147-65-45.eu.ngrok.io -> http://localhost:8000
Forwarding https://20e8-94-147-65-45.eu.ngrok.io -> http://localhost:8000
Connections ttl opn rt1 rt5 p50 p90
12 0 0.00 0.01 1.26 233.97
当我在ngrok上搜索类似的webhook流量问题时,从这篇文章中可以看出,ngrok不允许通过https进行流量。
我使用的不是ngrok,而是localtunnel。这解决了问题。