简体   繁体   English

Cloudflare with Stripe webhook 返回 HTTP 301 错误

[英]Cloudflare with Stripe webhook returns HTTP 301 error

I am running a NodeJS server on DigitalOcean that is listening for Stripe webhooks on the route /stripe-webhook with NGINX as a reverse proxy.我在 DigitalOcean 上运行一个 NodeJS 服务器,它正在侦听路由/stripe-webhook上的 Stripe webhooks,使用 NGINX 作为反向代理。 It works perfectly during testing with the Stripe CLI on my local machine.在我的本地机器上使用 Stripe CLI 进行测试时,它可以完美运行。 However when I deploy to the server the Stripe dashboard always shows a HTTP 301 error code when it sends an event to the domain.但是,当我部署到服务器时,Stripe 仪表板在向域发送事件时总是显示 HTTP 301 错误代码。

The domain is hosted on Cloudlfare which provides https.该域托管在提供 https 的 Cloudlfare 上。 In the Stripe dashboard it is configured to send the webhook to https://example.com/stripe-webhook so I am not too sure why it is showing a redirect error?在 Stripe 仪表板中,它被配置为将 webhook 发送到https://example.com/stripe-webhook所以我不太确定为什么它显示重定向错误? When I send a manual POST request to the same URL it works fine and does not return any redirect header.当我向同一个 URL 发送手动 POST 请求时,它工作正常并且不返回任何重定向标头。

Any help would be greatly appreciated.任何帮助将不胜感激。 Cheers干杯

相当微小的错误,我的 Stripe 仪表板将 webhooks 发送到https://example.com/stripe-webook但我的 NGINX 配置正在侦听https://example.com/stripe-webhook/它正在重定向以添加额外的斜杠因为 Stripe 有一个带有 webhooks 的 0 重定向策略,所以它抛出了一个错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM