0
votes

I am having some issues finding how to properly write my ngrok.yml file such that it will start the tunnel using https. What I have at the moment is the following:

tunnels:
  invenutory:
    proto: http
    addr: 44328
    host_header: localhost

The issue here is that if I use the url ngrok gives me it does not connect (i test this by seeing if it hits my healthcheck endpoint, it does not). However, if I start ngrok using the following command: ngrok http https://localhost:44328 -host-header="localhost:44328" then it will properly hit my endpoint. How can I make my config file act the same way?

Edit:

If I set the addr to be addr: "https://localhost:44328" then it does properly use https, but for some reason this seems to me like an incorrect way of doing it.

1
IMO you need to add the port number to the host_header value: host_header: localhost:44328. In the examples from the documentation the ports used are default ports, so they are not needed. In your command line you are specifying also host:port and not only host. Quote: The "Host" header field in a request provides the host and port information from the target URIkeenthinker
I did try setting host_header to be that, but it still looks like both https and http of the ngrok tunnel were still mapping to http only instead of http going to http and https going to https. Is it a limitation of having a free account?SomeStudent
I see. I am not sure about the free account, but it does not look like it.keenthinker
It is alright for now I guess, that work around I posted in my edit should suffice for my needs for nowSomeStudent

1 Answers

0
votes

To start a https only tunnel with a ngrok http tunnel, use the flag -bind-tls.

This is unrelated to how you use addr, which can be used to let ngrok know if your local server is listening for http or https.

From the docs:

ngrok assumes that the server it is forwarding to is listening for unencrypted HTTP traffic, but what 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.