The following is my tls backend:
package main
import (
"fmt"
"net/http"
)
const (
PORT = ":8443"
PRIV_KEY = "./private_key"
PUBLIC_KEY = "./public_key"
)
func rootHander(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Nobody should read this.")
}
func main() {
http.HandleFunc("/", rootHander)
err := http.ListenAndServeTLS(PORT, PUBLIC_KEY, PRIV_KEY, nil)
if err != nil {
fmt.Printf("main(): %s
", err)
}
}
The keys are generated using these two lines:
openssl genrsa -out private_key 2048
openssl req -new -x509 -key private_key -out public_key -days 365
When I start the tls server, and visit the site with a browser (https://example.com:8443) I get the expected result, after ignoring the browser warning:
Nobody should read this.
So far everything is cool.
Now, when I point my browser to http://example.com:8443 (notice that http is used, not https) I get the following result for Firfox (Chrome does the same, but downloading the site):
Question: Why is there a question mark?