al.koval
al.koval

Reputation: 2542

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?

Upvotes: 17

Views: 32704

Answers (6)

vilem cech
vilem cech

Reputation: 185

If u need to run multiple tunnels on a free-plan u can modify config as

version: "2"
authtoken: 2OS8VCciyOWXR7XM33rh6RY79jT_7u8VsgzzfwoewzGnfG3lV
tunnels:
  first:
    addr: 5173
    proto: http    
  second:
    proto: http
    addr: https://localhost:7125
    host_header: rewrite
    schemes: [https]

and then run

ngrok start --all

to find config run

ngrok config check

Upvotes: 0

elfico
elfico

Reputation: 550

Update as March 2023.

After failing to get it running using all options above. I found the following from their documentation : https://ngrok.com/docs/secure-tunnels/tunnels/http-tunnels/#host-header

To tunnel http

e.g

ngrok http --host-header=rewrite http://localhost:44345

if using https, e.g

ngrok http --host-header=rewrite --scheme=https https://localhost:44345

Upvotes: 7

al.koval
al.koval

Reputation: 2542

  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

Upvotes: 52

Seun Daniel Omatsola
Seun Daniel Omatsola

Reputation: 91

Now you have to put a -- before the host header

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

Upvotes: 5

Tulshi Das
Tulshi Das

Reputation: 478

You can use Ngrok Extensions in visual studio. The tunneling process is very easy.

Upvotes: 0

Marko Prcać
Marko Prcać

Reputation: 580

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)

Upvotes: 13

Related Questions