One of the requests is likely the browser looking for /favicon.ico.
In cases like this (wondering "what are these requests?") it's usually a
good idea to log things like the actual request URI used and the request
method.
> I've made a small poc api on my windows 10 enterprise machine
>
> ```
> func main() {
> srv := &http.Server{Addr: ":8000", Handler: http.HandlerFunc(handle)}
> log.Fatal(srv.ListenAndServeTLS("certificate.crt", "certificate.key"))
> }
>
> func handle(w http.ResponseWriter, r *http.Request) {
> // Log the request protocol
> log.Printf("Got connection: %s", r.Proto)
>
> // Send a message back to the client
> w.Write([]byte("Hello"))
> }
> ```
> The moment I call this api using different
> browsers(IE/Chrome)(
https://localhost:8000) or curl request I receive
> these kind of outputs:
>
> 1. In browser I receive "Hello" which is correct
> 2. In golang console prompt I get this log twice: Got connection: HTTP/2.0
>
> Without TLS:
>
>
>
> 3. But, while making a curl request I get this log & only once:
>
> What is the difference between point 2 & 3. I've tried both tls and non
> tls version with browsers but in both the cases logs are coming twice. I
> don't know why this favicon.ico call is going.
>
> Am I missing something here. Please help. Thank you
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
golang-nuts...@googlegroups.com
> <mailto:
golang-nuts...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/golang-nuts/216a565e-5fae-4e41-b5fb-7af3ff735fc3n%40googlegroups.com
> <
https://groups.google.com/d/msgid/golang-nuts/216a565e-5fae-4e41-b5fb-7af3ff735fc3n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Gregor Best
be...@pferdewetten.de