App Engine Encoding Acceptance

The APP Engine API mentions that if a request comes with "Accept-Encoding" it automatically compresses the response.

But when I look at the request, the header is not there. but in the browser it is installed. when I try to explicitly set the header (using jQuery ajax ), a message appears:

  Refused to set unsafe header "Accept-Encoding" 

But this situation does not occur when working in the local request host has the title “Accept-Encoding”. this only happens after publication. but it doesn’t allow you to set "Accept-Encoding" explicitly always.

I searched everywhere, but could not find an explanation for the problem. It would be very helpful if someone can explain ...

+5
source share
2 answers

You have two different problems:

  • App Engine does not compress the response. GAE uses a number of factors to determine whether response compression is necessary. When making a decision, the type of content and user agent are taken into account. See Answer Nick Johnson (from GAE Team).

  • jQuery refuses to set the Accept-Encoding header. Note that this is a jQuery issue and has nothing to do with GAE. See This: Is it possible to get jQuery to make AJAX calls for gzip / deflate enabled URLs?

+6
source

I have a similar problem, as in the HTTPRequest header, "Accept-Encoding" is NULL. As GAE explained, it searches for Accept-Encoding and User-Agent headers if it wants to compress. but in my case, GAE cannot recognize whether to compress.

The header is set in the browser, but it is not in the request header.

+3
source

Source: https://habr.com/ru/post/900656/


All Articles