Can I send resources with HTTP/2 Server Push?

103 views Asked by At

My webapp, written in Go, deployed on Google App Engine Standard, has handlers to generate HTML for each page (server-side rendering). It would be nice for performance if I could in certain cases (cautiously) pre-emptively send CSS and JS resources along with the HTML response, with HTTP/2 Server Push.

Is it possible with the Go runtime of App Engine?

(Another way of putting this: does the ResponseWriter in App Engine implement the http.Pusher interface?)

1

There are 1 answers

0
Deleplace On

This doesn't seem to be possible out-of-the-box right now:

if _, ok := w.(http.Pusher); ok {
    fmt.Fprintln(w, "This ResponseWriter is a Pusher :)")
} else {
    fmt.Fprintln(w, "This ResponseWriter is NOT a Pusher :(")
}

produces

This ResponseWriter is NOT a Pusher :(

(in production, and in the local dev server as well)