|
-
November 8th, 2002, 11:36 PM
#1
Senior Member
apache: mod_gzip and cgi scripts...
Hey everyone,
I just installed mod_gzip so I could use less bandwith, the pages are smaller, etc. Now I got cgi scripts to compress ok, but there's one that I'm having trouble with. I don't know if it has to do with the apache config or whatever. Here's the mod_gzip config in the httpd.conf file:
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static No
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 500000
mod_gzip_maximum_inmem_size 60000
mod_gzip_min_http 100
mod_gzip_handle_methods GET POST
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include mime ^text/plain$
mod_gzip_item_include mime ^application/x-httpd-cgi$
mod_gzip_item_include handler ^cgi-script$
# mod_gzip_item_include handler ^perl-script$
mod_gzip_item_exclude file \.css$
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude mime ^image/.*
mod_gzip_dechunk yes
mod_gzip_temp_dir /tmp
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate yes
mod_gzip_send_vary Yes
mod_gzip_add_header_count Yes
</IfModule>
Everything looks ok in there, and here's the return header of the cgi script:
HTTP/1.1 200 OK
Date: Fri, 08 Nov 2002 22:22:26 GMT
Server: Apache/1.3.26 (Trustix Secure Linux/Linux) mod_perl/1.26 mod_gzip/1.3.26.1a
Set-Cookie: iBSessionID=7828df3086987b5ff934e25d517beacc; path=/; expires=Sat, 09-Nov-2002 22:22:28 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Connection: close
Content-Type: text/html; charset=ISO-8859-1
I have expires active on so any proxies wouldn't cache this page since its a bb. Any clues to why it wouldn't compress?? btw for the record, I am using http://leknor.com/code/gziped.php to check the gzip.
Thanks
-Mike
Either get busy living or get busy dying.
-The Sawshank Redemption
-
November 10th, 2002, 07:24 AM
#2
Senior Member
I guess I was just a bit impatient (I figured it out)
In case any of you want to know:
The script was returning a header "Content-Type: text/html; charset=ISO-8859-1", which wasn't being compressed, but a normal .htm document with a "Content-Type: text\html" was being compressed. The line "mod_gzip_item_include mime ^text/html$" meant that anything with the mime type text/html was going to be compressed, but the cgi script also appended the charset stuff to the end, so that's what threw it off.
So I fixed it by using
Code:
mod_gzip_item_include mime ^text/html.*
instead of
Code:
mod_gzip_item_include mime ^text/html$
(So anything beginning with text/html would be compressed.)
Thanks anyway everyone 
-Mike
Either get busy living or get busy dying.
-The Sawshank Redemption
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|