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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > [Resolved] mime.properties - js=application/x-javascript vs js=application/javascript

Reply
 
Thread Tools Display Modes
  #1  
Old 04-22-2010, 07:18 AM
MikeDVB MikeDVB is offline
Senior Member
 
Join Date: Jul 2009
Posts: 218
Default [Resolved] mime.properties - js=application/x-javascript vs js=application/javascript

I found that LiteSpeed was not gzip compressing .js files with the type application/x-javascript in the gzip list (which is by default) and the same mime type inside of mime.properties.

I tested using this test: http://www.whatsmyip.org/http_compression/

When doing a curl -I of the .js file I was getting this: Content-Type: application/javascript

I tried adding that to the gzip compression line but that simply did not work - I had to add it to the compression line as well as change the mime type in the mime.properties to get gzip compression working for .js files.

Do these settings need to be changed for both for it to work or what? Setting it to application/x-javascript in mime.properties simply wasn't working for FireFox, IE, or curl -I as near as I could tell.
__________________
Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Semi-Dedicated, and VPS
http://www.mddhosting.com/

Last edited by NiteWave; 04-27-2010 at 09:14 PM..
Reply With Quote
  #2  
Old 04-22-2010, 06:49 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,217
another trick is to add a MIME type, say

js2 application/javascript

the issue you described is because .js type redefined from x-javascript to javascript somewhere in http.conf or .htaccess. if no such redefinition, litespeed by default will compress .js well as x-javascript.
Reply With Quote
  #3  
Old 04-22-2010, 06:50 PM
MikeDVB MikeDVB is offline
Senior Member
 
Join Date: Jul 2009
Posts: 218
Quote:
Originally Posted by NiteWave View Post
another trick is to add a MIME type, say

js2 application/javascript

the issue you described is because .js type redefined from x-javascript to javascript somewhere in http.conf or .htaccess. if no such redefinition, litespeed by default will compress .js well as x-javascript.
It's a cPanel server - we didn't change any mime types on the server itself or in LiteSpeed until we noticed that it simply was not compressing javascript.

I mean I have no problem making the changes to the mime.properties file and the compression settings in LiteSpeed on each install but realistically why should we have to do this?
__________________
Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Semi-Dedicated, and VPS
http://www.mddhosting.com/
Reply With Quote
  #4  
Old 04-22-2010, 07:08 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,217
yes, agree with you. the redefinition is from cPanel, if I remember correctly.
Reply With Quote
  #5  
Old 04-22-2010, 08:13 PM
MikeDVB MikeDVB is offline
Senior Member
 
Join Date: Jul 2009
Posts: 218
Quote:
Originally Posted by NiteWave View Post
yes, agree with you. the redefinition is from cPanel, if I remember correctly.
I actually just added application/javascript to the default gzip line:


Any chance that maybe we can get application/javascript added to this line by default, surely it's not going to hurt anything.
__________________
Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Semi-Dedicated, and VPS
http://www.mddhosting.com/

Last edited by MikeDVB; 04-22-2010 at 08:17 PM..
Reply With Quote
  #6  
Old 04-22-2010, 08:45 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,217
in litespeed, you can try my previous suggestion: set js2 as MIME type:application/javascript. this change may be enough(can remove other changes). -- as a cPanel patch.
Reply With Quote
  #7  
Old 04-22-2010, 09:19 PM
MikeDVB MikeDVB is offline
Senior Member
 
Join Date: Jul 2009
Posts: 218
Quote:
Originally Posted by NiteWave View Post
in litespeed, you can try my previous suggestion: set js2 as MIME type:application/javascript. this change may be enough(can remove other changes). -- as a cPanel patch.
Easier to just add application/javascript to the gzip line in LiteSpeed (doesn't require shell access or anything).
__________________
Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Semi-Dedicated, and VPS
http://www.mddhosting.com/
Reply With Quote
  #8  
Old 04-24-2010, 01:33 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,217
may need add "application/javascript" to "Expires By Type"

Server-->General-->Expires By Type

the root cause in summary is because there is following directive somewhere in cPanel:
AddType application/javascript .js
which override litespeed's default MIME type for .js:
application/x-javascript .js
Reply With Quote
  #9  
Old 04-27-2010, 08:48 PM
Jamesc Jamesc is offline
New Member
 
Join Date: Apr 2010
Posts: 3
After changing the said changes, the files with .js still do not perform gzip
compression. I am using litespeed v4.0.14.
Here are my settings.

GZIP Compression --> Compressible Types --> application/x-javascript
Expires Settings --> Expires By Type --> application/x-javascript=A604800

Please advise.
Reply With Quote
  #10  
Old 04-27-2010, 08:51 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,217
Code:
GZIP Compression --> Compressible Types --> application/x-javascript
Expires Settings --> Expires By Type --> application/x-javascript=A604800
application/x-javascript already there, should add application/javascript

i.e.,
Code:
GZIP Compression --> Compressible Types --> application/javascript
Expires Settings --> Expires By Type --> application/javascript=A604800
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 06:50 PM.



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