0

I was using Nginx1.4.6 when I realized that I have to set gzip off;to be able to set the ETag header with php.
After reading this post I did an upgrade to Nginx 1.10.1 using chef. I added the repository to the apt cookbook with

apt_repository 'nginx-php' do
    uri          'ppa:nginx/stable'
    distribution node['lsb']['codename']
end  

And then upgraded nginx with:

package 'nginx' do
   action :upgrade
end  

But everything seems to be same as with the older nginx version.
Only if I explicitly set gzip off; I can set the ETag header.

Also I did not see the etag on; directive in my nginx.conf file and setting it manually did not have any effect.

It could be that I just need to do a vagrant destroy and vagrant provision again - but I think I am missing something here.

UPDATE:
I got it working now after detroying the machine again and also deleting the .vagrant folder. But I am not shure if that was the problem. Now I can set ETag headers and the Request contains the If-None-Match header. But my Etags get translated into weak Etags and nginx prepends a W/ before the hash. Is this the default behaviour ? and how can I set strong Etags ?

UPDATE:
Alright because of gzip on; the etag is weak ...is there no way to set a strong etag with gzip enabled ?

Community
  • 1
  • 1
FitzPatrick
  • 175
  • 10
  • Do you see the nginx executable actually get upgraded as expected? If so, please remove the `chef` tag as this is unrelated to Chef. – coderanger Aug 24 '16 at 23:08
  • Well it must -when I do `nginx -v` it tells me `nginx version: nginx/1.10.1`. I also destroyed the vmbox and was setting it up again to make shure there are no remnants of the older nginx version - but still the same problem. – FitzPatrick Aug 26 '16 at 08:57
  • 1
    Try killing all stale workers, after reload they may still linger for some time due to keepalives/websockets – Vasfed Aug 26 '16 at 09:02
  • I am no networking / server expert - can you tell me how to do that ? I was thinking vagrant destroy destroys everything ? – FitzPatrick Aug 26 '16 at 09:07

1 Answers1

1

Answering my own question.

A strong Etag (with php) is set when using

ob_start('ob_gzhandler')

before headers are sent.

FitzPatrick
  • 175
  • 10