homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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

 4:04 am on Aug 11, 2011 (gmt 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)

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)

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)

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

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.



 11:18 pm on Aug 12, 2011 (gmt 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).

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved