Reputation: 33
I'm trying to send a compressed file through AppEngine, my function is
func handleWebGLRequest(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
blobKey, err := blobstore.BlobKeyForFile(c, "/gs/<path>/WebGL.datagz")
if err != nil {
fmt.Fprintf(w, "Problem: cannot find WebGL.data")
return
}
w.Header().Set("Content-Type", "blah/blah/application/octet-stream")
w.Header().Set("Content-Encoding", "gzip")
blobstore.Send(w, blobKey)
}
The file is sent, the content-type appears correctly in the response header with "blah/blah/application/octet-stream", but Content-Encoding is never in the response header, which (I think) is the cause of other issues I'm having.
Does anyone know why it doesn't work?
(In case it matters - I'm using chrome inspector to view the response headers, and here it is, source not parsed
HTTP/1.1 200 OK Content-Type: blah/blah/application/octet-stream Transfer-Encoding: chunked Date: Tue, 28 Apr 2015 06:50:09 GMT Server: Google Frontend Alternate-Protocol: 80:quic,p=1)
Much appreciated
Upvotes: 0
Views: 356
Reputation: 7067
You can't control this header, the servers actually try to serve gzipped content as frequently as possible, as long as they're confident the browser will support it.
How do I serve compressed content?
Google App Engine does its best to serve gzipped content to browsers that support it. Taking advantage of this scheme is automatic and requires no modifications to applications.
Upvotes: 1