Closed fyaacobseek closed 1 week ago
From ChatGPT:
Go has to ensure the Domain Resolves to a Local IP. If fadhil-blog.dev is hosted on a remote server but resolves correctly, try setting the Go server to listen on :8080 instead of explicitly specifying the domain. This approach allows the server to respond to any incoming requests on that port, regardless of the hostname.
When I set 127.0.0.1 fadhil-blog.dev
in my /etc/hosts
file, the go program runs fine.
Hey @fyaacobseek glad you figured this out. Just a note for you. When you go to host this application on a remote server you will need to set the IP address to either the server that is running the app or what many people will do is just set the app to listen on all interfaces with 0.0.0.0:8080
To Reproduce
Run the server with following code:
When I run my go program, it immediate terminate with no error.
Expected behavior
Framework version (please check if it happens with the last Fuego version before posting):
github.com/go-fuego/fuego v0.14.0
Go version (please check if it happens with the last Go version before posting):
go 1.23.0
Additional context
I was checking ChatGPT, both
http.ListenAndServe
andhttp.ListenAndServeTLS
do not accept domain name. From my testing, it only works when I providelocalhost
as host name.