LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Double Gzip?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2010, 12:39 PM
rok rok is offline
New Member
 
Join Date: Jan 2010
Posts: 5
Smile Double Gzip?

I have drupal site with Boost module for gzip file css,js config in .htaccess.
Quote:
### BOOST START ###
AddDefaultCharset utf-8
FileETag MTime Size
<FilesMatch "(\.html|\.html\.gz|\.json|\.json\.gz)$">
<IfModule mod_headers.c>
Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
</IfModule>
</FilesMatch>
<IfModule mod_mime.c>
AddCharset utf-8 .html
AddCharset utf-8 .css
AddCharset utf-8 .js
AddCharset utf-8 .json
AddEncoding gzip .gz
</IfModule>
<FilesMatch "(\.html|\.html\.gz)$">
ForceType text/html
</FilesMatch>
<FilesMatch "(\.json|\.json\.gz|\.js|\.js\.gz)$">
ForceType text/javascript
</FilesMatch>
<FilesMatch "(\.css|\.css\.gz)$">
ForceType text/css
</FilesMatch>

# Gzip Cookie Test
RewriteRule boost-gzip-cookie-test\.html cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html]

# GZIP - Cached css & js files
RewriteCond &#37;{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript]

# NORMAL - Cached css & js files
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^GET$ [OR]
RewriteCond %{REQUEST_URI} (^(admin|cache|misc|modules|sites|system|openid|th emes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{HTTPS} on
RewriteRule .* - [S=5]

# GZIP
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz [L,T=text/javascript]

# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript]

### BOOST END ###
But when i enter site apear strange symbol...:
�������=ks
http_://174.120.219.172/
I turn off gzip on webadmin LS but not soldve this pbl.Anyone help me?.I just want config gzip inside my drupal,not by server.

Last edited by rok; 01-27-2010 at 09:22 AM..
Reply With Quote
  #2  
Old 01-26-2010, 12:42 PM
rok rok is offline
New Member
 
Join Date: Jan 2010
Posts: 5
This .htaccess working good on apache...
Reply With Quote
  #3  
Old 01-27-2010, 03:03 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
I studied this case, has some progress.

access:
http_://174.120.219.172/
same output as said:
�������=ks

http_://174.120.219.172/?xxx
can see some normal output but not all.

checking .js and .css files, they are in gzip format, there's the cause why the page not display correctly.

comparing with output of normal .js and .css file in firebug, there is a "Content-Encoding: gzip" in response headers.

so you compress the .js and .css files yourself, but not give "Content-Encoding: gzip" header at the same time. so you may try to add this header for the compressed .css and .js files, see if resolve the issue.
Reply With Quote
  #4  
Old 01-27-2010, 09:24 AM
rok rok is offline
New Member
 
Join Date: Jan 2010
Posts: 5
Thanks...I've added some config of my .htaccess file...
When remove this:
Quote:
# GZIP
RewriteCond &#37;{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz [L,T=text/javascript]
Then site working good...But when add this,site not working...
Reply With Quote
  #5  
Old 01-27-2010, 11:21 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
I did some tests, this may work for your special purpose: add
Code:
<FilesMatch "(\.html\.gz|\.json\.gz)$">
Header set Content-Encoding "gzip"
</FilesMatch>
Reply With Quote
  #6  
Old 01-28-2010, 07:38 AM
rok rok is offline
New Member
 
Join Date: Jan 2010
Posts: 5
Quote:
Originally Posted by NiteWave View Post
I did some tests, this may work for your special purpose: add
Code:
<FilesMatch "(\.html\.gz|\.json\.gz)$">
Header set Content-Encoding "gzip"
</FilesMatch>
And remove this?
Quote:
# GZIP
RewriteCond &#37;{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html \.gz [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json \.gz [L,T=text/javascript]
Reply With Quote
  #7  
Old 01-28-2010, 05:36 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
do not remove #GZIP part. just add.

it's not difficult and no hurt to try with or without #GZIP rules. Please share the test result.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:27 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.