Welcome to WebmasterWorld Guest from 23.23.54.109

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

ob gzhandler() not setting "Vary: Accept-encoding" when uncompressed

     
4:04 am on Aug 11, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Oct 9, 2007
posts: 295
votes: 0


I am using ob_gzhandler() to dynamically handle GZIP compression on a server which doesn't allow it done by htaccess.

It adds "Accept-encoding" to the Vary: header, as it should, when the body is Gzipped.

However when the client sends no Accept-Encoding: header, and the response is accordingly uncompressed, it does not add this Vary header.

This causes various bug checking tools to complain, and could mess up caching.

I know I can manually add Vary: Accept-encoding, and I am, but is that my only solution - just confirming this is a bug and I'm not missing something?
10:21 am on Aug 12, 2011 (gmt 0)

Senior Member from ES 

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 11, 2003
posts: 1379
votes: 0


Have you searched ob_gzhandler Accept-encoding? I've not run into the issue you are describing but perhaps it is out there?

Sorry I cannot be of more help...
11:49 am on Aug 12, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Oct 9, 2007
posts:295
votes: 0


mipapage, have you tested it with a browser not sending an Accept-Encoding request header? What version of PHP?
10:51 pm on Aug 12, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12541
votes: 1


Why not use zlib instead? From the ob_gzhandler [php.net] page itself:


Note:
You cannot use both ob_gzhandler() and zlib.output_compression. Also note that using zlib.output_compression is preferred over ob_gzhandler().


Try it instead, see if your issues are resolved. Much better solution anyway.

[php.net...]
11:18 pm on Aug 12, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Oct 9, 2007
posts:295
votes: 0


Shared host, I don't have access to php.ini.

I'd also want the ability to not use it with some PHP scripts (piping/generating images).