1

Is there anybody that success implement h2c(HTTP/2 Plain text) Protocol in beego as a server?

I have tried to use http/2 from golang.org/x/net/http2 package using this approach https://beego.me/docs/mvc/controller/router.md#handler-register

I have implemented like this

h2server := &http2.Server{}

    handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        _, _ = fmt.Fprintf(w, "Hello, %v, http: %v", r.URL.Path, r.TLS == nil)
    })

    server := &http.Server{
        Addr:    "0.0.0.0:" + strconv.Itoa(beego.BConfig.Listen.HTTPPort),
        Handler: h2c.NewHandler(handler, h2server),
    }

But all of my beego.router must move into the handler.

Is there any other better approach with that?

Thanks

FEF

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.