Welcome to WebmasterWorld Guest from 54.163.115.193

Forum Moderators: coopster & jatar k

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

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

5+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

5+ Year Member



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)

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



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)

5+ Year Member



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).
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month