inconshreveable / ngrok

Unified ingress for developers

Home Page:https://ngrok.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Successfully create tunnel, not able to connect to it

elopez00 opened this issue · comments

I feel like I'm going crazy! Here is my situation:

I have a go program that runs the server using the following:

env := env.GetInstance()

// start the server using config
listener, err := ngrok.Listen(
	context.Background(),
	ngrokConfig.HTTPEndpoint(
		ngrokConfig.WithDomain(env.Station),
	),
	ngrok.WithAuthtoken(env.NgrokAuthToken),
)
// check if any errors ocurred
if err != nil {
	log.Fatal(err)
}

log.Println("Server starting with ngrok on:", listener.URL())
if err := http.Serve(listener, router.Get()); err != nil {
	log.Fatal(err)
}

This successfully runs and in my terminal I get the:

2024/04/02 22:16:54 Server starting with ngrok on: https://<my-static-domain>.app

However, when I go to https://<my-static-domain>.app, I get connection refused. Mind you, there are no errors stated by ngrok, and when I check the endpoints page, it says that I have an active tunnel.

I think, hmm, maybe there is something wrong w/ my code? So I decide to run my server locally on port 8080, and then run the following on ngrok:

ngrok http --domain=<my-static-domain>.app 8080

At this point, I see this:

ngrok                                                                                                                     (Ctrl+C to quit)
                                                                                                                                          
Full request capture now available in your browser: https://ngrok.com/r/ti                                                                
                                                                                                                                          
Session Status                online                                                                                                      
Account                       Me (Plan: Free)                                                                                  
Version                       3.8.0                                                                                                       
Region                        <my-region>                                                                     
Latency                       27ms                                                                                                        
Web Interface                 http://127.0.0.1:4040                                                                                       
Forwarding                    https://<my-static-domain>.app -> http://localhost:8080                
                                                                                                                                          
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                 
                              0       0       0.00    0.00    0.00    0.00  

I try hitting my endpoint and still nothing! Is there something I'm missing? I've tried this procedure in both my Macbook and my PC and cannot for the life of me hit my static domain, just get connection refused. What am I doing wrong?

@elopez00 thank you for your issue, but this is the wrong place. If you are using the official ngrok agent sdk, please let me know and I will transfer this issue to https://github.com/ngrok/ngrok-go. If you are using another library, please open it in the respective repo.

This repository is no longer actively maintained and will be archived soon to reduce confusion with the latest ngrok versions. We thank you for the continued support of ngrok and look forward to seeing you over at https://ngrok.com/ and https://ngrok.com/docs/ .