Search code examples
botframeworkremote-accesshttp-status-code-405ngrokhttp-tunneling

Ngrok returns 405 error while tunneling my localhost


I have a web app bot that I would like to remote it so a few people can test it. I am using Bot Framework Emulator to test it locally and it works wonders, but I'm thoroughly failing to make ngrok host it.

(I actually managed doing it using the ...azurewebsites.net/api/messages link my app has in Azure with another bot, but I couldn't with this one, so I'm trying with the link ngrok offers me - both bots, the one I managed and this one, are hosted in Azure, but I don't know how to make it available to remote access)

Steps I'm taking:

  1. Deploy the app in Visual Studio so it runs on localhost:3979;

  2. Open port externally in ngrok using ngrok 3979 http -host-header=rewrite localhost:3979;

  3. Get one of the forwarding URLs ngrok provides me, like https://3d609207.ngrok.io

  4. Insert previous URL in Bot Framework Emulator;

  5. Click Connect.

Both in ngrok and in Bot Framework Emulator returns me 405 Method Not Allowed.

I tried accessing the link I inserted in Bot Framework Emulator and I normally have the page I would see while hosting my bot locally:

Describe your bot here and your terms of use etc.

Visit Bot Framework to register your bot. When you register it, remember to set your bot's endpoint to

https://your_bots_hostname/api/messages

But I can't send nor receive messages in Bot Framework Emulator.

Additionally, ngrok prints this under the HTTP request headline:

HTTP Requests
-------------

POST /                         405 Method Not Allowed
GET  /favicon.ico              200 OK
GET  /                         200 OK

My MSAppID and Password are configured properly in web.config, and compilation results in no error, so I doubt it's something on the code (unless there is some configuration in the code that prevents this bot being accessed remotely for a reason, but I have no idea).

I would very much appreciate any help on this issue. Thanks for your time.


Solution

  • Both in ngrok and in Bot Framework Emulator returns me 405 Method Not Allowed

    I can reproduce the issue on my side if I just provide https://xxxxxxxx.ngrok.io as message endpoint.

    enter image description here

    Please try to specify https://xxxxxxxx.ngrok.io/api/messages as message endpoint, which works for me.

    enter image description here