Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngrok and https tunnel for asp.net core application

The ASP.NET CORE application, when launched from visual studio, has the address https://localhost:44313/. To test the performance you need to make a tunnel. I use ngrok and the command:

ngrok http -host-header=localhost 44313

But this does not work for https.

Can anyone share a working example?

like image 553
al.koval Avatar asked Feb 21 '19 06:02

al.koval


People also ask

Does Ngrok use https?

Local HTTPS servers ngrok assumes that the server it is forwarding to is listening for unencrypted HTTP traffic, but if your server is listening for encrypted HTTPS traffic, you can specify a URL with an https:// scheme to request that ngrok speak HTTPS to your local server.

What is Ngrok tunnel?

Ngrok is a cross-platform application that exposes local server ports to the Internet. Their website claims, “[so you can] spend more time programming—one command for an instant, secure URL to your localhost server through any NAT or firewall.”


2 Answers

  1. Download the current version of ngrok
  2. Register and get a token: https://dashboard.ngrok.com/auth
  3. Run ngrok and set the token with the command: ngrok authtoken YOUR_AUTHTOKEN
  4. Create a tunnel: ngrok http -host-header=localhost https://localhost:44313

Update 11 april 2019

like image 123
al.koval Avatar answered Sep 20 '22 21:09

al.koval


Using ngrok version 2.3.29 and added authtoken (not sure if authtoken influences outcome, I've just added it following the online installation guide).

This command worked for me:

ngrok http https://localhost:{your-app-port} -host-header=localhost:{your-app-port}

Difference from existing answer: I pass localhost:port to -host-header

Difference form your question: I use ngrok http https://localhos:port instead of ngrok http http://localhos:port (https instead of http)

like image 45
Marko Prcać Avatar answered Sep 23 '22 21:09

Marko Prcać