Ngrok没有将我的发布请求传递到本地主机 [英] Ngrok not passing my post request on to localhost

查看:82
本文介绍了Ngrok没有将我的发布请求传递到本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据

但是现在当我尝试在Postaman中使用它

ex

更新-ngrok给我发了电子邮件问题在于HTTPS.ngrok终止HTTPS流量,然后将未加密的http流量转发到本地应用程序.您要执行以下两项操作之一:

1)使您的应用程序也公开一个HTTP端口,并将流量转发给该端口2)使用ngrok的TLS隧道(将TLS流量交给您进行终止).使用此选项,您将拥有执行证书管理,证书不匹配等所有复杂性,仅此而已.如果可能的话,我会推荐#1"

问题-有人知道如何使用Https在ASP.Net MVC应用程序中打开http端口吗?

解决方案

我的问题是我的应用程序中的断点没有命中.

我正在使用

  ngrok http 58533 

但是将其更改为以下值可以使我的断点受到攻击.

  ngrok http -host-header = rewrite localhost:58533 

I'm trying to set up a webhook for Stripe and I've created a controller, according to the Stripe doc , to do it in ASP.Net MVC running in a virtual machine (maybe that changes things?). I've been testing the action in the controller to see if I can receive posts, so I'm using Postman to send my localhost posts requests which are working. But now I need to use Ngrok to give my localhost a url so that Stripe can use it. I'm running ngrok and passing in these parameters to run

ngrok http -host-header="localhost:44368" 44368

and here is what I see, everything looks ok

But now when I try and use it in Postaman

ex https://11d1ba97.ngrok.io/StripeWebHook/Index

I get a 502 Bad Gateway message and the action method never gets hit.

I get the same problem when I try and send a test webhook from Stripe. FYI - The request times from Ngrok using 'localhost:4040' show all my response times as 0ms.

Update - I was emailed by ngrok "The trouble is the HTTPS. ngrok terminates HTTPS traffic and then forwards the unencrypted http traffic through to your local application. You want to do one of two things:

1) make your application expose an HTTP port as well and forward traffic to that 2) use ngrok's TLS tunnels (which hand of TLS traffic to you for termination). with this option you have all the complexities of doing cert management, cert mismatches, etc, just fyi. i'd recommend #1 if possible"

Question - anyone know how to open up a http port in a ASP.Net MVC app using Https?

解决方案

My problem was that the breakpoint in my application wasn't getting hit.

I was using

ngrok http 58533

but changing it to the following allowed my breakpoint to get hit.

ngrok http -host-header=rewrite localhost:58533

这篇关于Ngrok没有将我的发布请求传递到本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆