Reputation: 110163
Does Google App Engine allow compression of the results? For example, I have the following curl request:
$ curl --location --request GET 'https://premiere-stage2.uk.r.appspot.com/' \
> --header 'Accept-Encoding: gzip, deflate, br'
And the response is not compressed. Compare this with something like:
$ curl --location -X GET 'https://google.com' --header 'Accept-Encoding: gzip, deflate, br'
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
Or, is there something manual I need to set up? I would think the last resort would be to do the compression in the application endpoints themselves, or is that how it needs to be done?
Upvotes: 2
Views: 870
Reputation: 6298
According to documentation
For example, the server may automatically send a gzipped response depending on the value of the Accept-Encoding request header. The application itself does not need to know which content encodings the client can accept.
That gives the impression it should. But the same documentation also says
In addition, the following headers are removed from incoming requests because they relate to the transfer of the HTTP data between the client and server:
- Accept-Encoding
I tested against our production site and in FireFox, Web Developer Tool shows Accept-Encoding: gzip, deflate, br
as a request header and a response header of content-encoding: gzip
However, when I tested against local/dev of our site, Web Developer Tool shows Accept-Encoding: gzip, deflate, br
as a request header but the response header didn't include content-encoding: gzip
. In addition, printing the headers in Flask/Python, gave a value of None
for Accept-Encoding
Upvotes: 1
Reputation: 110163
Expanding on John Hanley's suggestion in a comment, there are two parts to this.
Accept-Encoding
header in the request.text/html
or whatever it needs to be. Often the web server will ignore compression if the mime-type isn't in a certain list.-v
flag in curl.Putting it all together:
$ curl --location --request GET 'https://premiere-stage2.uk.r.appspot.com/html'
--header 'Accept-Encoding: gzip, deflate, br'
-v
References:
Upvotes: 1