Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beware: GZIP + Brotli #48

Closed
goaround opened this issue Mar 10, 2017 · 7 comments
Closed

Beware: GZIP + Brotli #48

goaround opened this issue Mar 10, 2017 · 7 comments
Labels
Milestone

Comments

@goaround
Copy link

Some client (Google Search Console + Google Crawler probably) have problems decoding with Brotli compressed gzip-files. If Brotli is active on the server.

At the moment the rocket-nginx.conf just checks if the client accept gzip and than serves the _gzip-file which will compressed again with Brotli:
# Is GZIP accepted by client ?
if ($http_accept_encoding ~ gzip) {
set $rocket_encryption "_gzip";
}

For this reason I check if the client accept Brotli and unset $rocket_encryption:
# Is Brotli accepted by client ?
if ($http_accept_encoding ~ br) {
set $rocket_encryption "";
}

@maximejobin
Copy link
Collaborator

Do you know what is the priority order and how it's set when both gzip and Brotli are active?

Thank you for letting me know.

@goaround
Copy link
Author

Nginx takes the gzip-file and compresses it again with Brotli on the fly.
That works with modern browsers nevertheless but some google tools and I guess the google bot, too have problems with it.

@maximejobin
Copy link
Collaborator

My understanding was that it was an alternative to GZIP. Not that it used the GZIP file and used Brotli after it. I did not see that in the documentation.

Can you educate me on your sources? That way, I can code it properly.

@goaround
Copy link
Author

It is an alternative to GZIP.
I think the problem is, rocket-nginx serves the gzip-file and Nginx don't know that the the file is gzip-compressed and compresses it again with Brotli.

With $http_accept_encoding ~ gzip you only check if the client accept gzip but it can accept br, too.

I let Google render a few pages without the check if the client accept br :
42rer 1
He took the gzip-file and the "Content-Encoding" says br
0hcyu

@maximejobin
Copy link
Collaborator

Ok, I get what you mean.

My main concern now is: when GZIP and BR are acceptable encoding, how do I ask Nginx (via the configuration file I made) what is the encoding that it will use ? Then, if it's "BR", the code suggestion you did make sense. If it's GZIP, we can use the code as is.

The question remains: when both are available, how can I know which one did Nginx pick ?

This is what I need to figure.

@goaround
Copy link
Author

I think if Brotli is active and the client accept it, it will take brotli.

@maximejobin
Copy link
Collaborator

I understand. Now, I need a confirmation of that behaviour. :-)

@maximejobin maximejobin added this to the 2.1 milestone Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants