ngrok and https tunnel for asp.net core application
Asked Answered
M

6

17

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?

Mannequin answered 21/2, 2019 at 6:21 Comment(0)
M
49
  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

Mannequin answered 22/2, 2019 at 3:46 Comment(4)
I still can't do over https, is there a chance you did other alterations?Collete
@Collete All as written above. But I use the latest current version.Mannequin
@Collete forgot to clarify, be sure to use the token obtained during authorization (dashboard.ngrok.com/auth)Mannequin
-host-header should be --host-headerBollen
N
13

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)

Nugget answered 2/6, 2019 at 18:42 Comment(2)
with version 3 you have to use --host-headerSternway
This fixed it for me, thanks! I don't think I understand why though. Previously I was forwarding to the http endpoint.Profiteer
A
6

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

Agulhas answered 29/3, 2023 at 13:1 Comment(0)
F
4

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

ngrok http https://localhost:{your-app-port} --host-header=localhost:"your-app-port"
Flask answered 14/7, 2022 at 21:21 Comment(0)
T
0

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

Texas answered 30/3, 2022 at 5:17 Comment(0)
S
0

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
Skurnik answered 18/5, 2023 at 17:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.