Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: TLS handshake error #7

Open
mateors opened this issue Oct 16, 2023 · 0 comments
Open

http: TLS handshake error #7

mateors opened this issue Oct 16, 2023 · 0 comments

Comments

@mateors
Copy link

mateors commented Oct 16, 2023

package main

import (
    // "fmt"
    // "io"
    "net/http"
    "log"
)

func HelloServer(w http.ResponseWriter, req *http.Request) {
    w.Header().Set("Content-Type", "text/plain")
    w.Write([]byte("This is an example server.\n"))
}

func main() {
    http.HandleFunc("/hello", HelloServer)
    err := http.ListenAndServeTLS(":443", "cert/server.crt", "cert/server.key", nil)
    if err != nil {
        log.Fatal("ListenAndServe: ", err)
    }
}

the above code generate following error when request using curl -sL https://localhost:443

2023/10/16 07:44:15 http: TLS handshake error from 127.0.0.1:49428: local error: tls: bad record MAC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant