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

Fix 'Vary' header #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix 'Vary' header #98

wants to merge 2 commits into from

Conversation

Jas0n99
Copy link

@Jas0n99 Jas0n99 commented Apr 7, 2020

Here is a patch regarding the issue I recently posted: #97 I used the nginx gzip_static module as a comparison since I know it works as-expected. I've tested this on my dev server and happy to report that it is no longer setting the header for images. It is correctly dynamically compressing content, and also correctly sending pre-compressed static files.

The only thing I'm not sure about is under 'NGX_HTTP_BROTLI_STATIC_ALWAYS', there's just the /* always */ comment. In the gzip_static module there is also rc = NGX_OK; which I'm not 100% sure if it should be there or not. I left it out (since I don't use the always option). Maybe it should be there?

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@Jas0n99
Copy link
Author

Jas0n99 commented Apr 7, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@NKjoep
Copy link

NKjoep commented Jul 19, 2020

@whalehub I was asking myself the same question.

I'd like to know when it will be merged by the Google team 🤗

if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ON) {
req->gzip_vary = 1;

if (rc != NGX_OK) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rc can not be != NGX_OK here

} else {
/* NGX_HTTP_BROTLI_STATIC_ON */
req->gzip_vary = 1;
if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ON) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferrable to have least-modification concise change. Just remove req->gzip_vary = 1 line

@@ -227,6 +227,14 @@ static ngx_int_t handler(ngx_http_request_t* req) {
return NGX_DECLINED;
}

if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ON) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be conditional here.
General rule - if compressed entry is going to be server - it must have vary header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants