|
|

04-22-2010, 07:18 AM
|
|
Senior Member
|
|
Join Date: Jul 2009
Posts: 218
|
|
[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..
|

04-22-2010, 06:49 PM
|
|
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.
|

04-22-2010, 06:50 PM
|
|
Senior Member
|
|
Join Date: Jul 2009
Posts: 218
|
|
Quote:
Originally Posted by NiteWave
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/
|

04-22-2010, 07:08 PM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,217
|
|
|
yes, agree with you. the redefinition is from cPanel, if I remember correctly.
|

04-22-2010, 08:13 PM
|
|
Senior Member
|
|
Join Date: Jul 2009
Posts: 218
|
|
Quote:
Originally Posted by NiteWave
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..
|

04-22-2010, 08:45 PM
|
|
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.
|

04-22-2010, 09:19 PM
|
|
Senior Member
|
|
Join Date: Jul 2009
Posts: 218
|
|
Quote:
Originally Posted by NiteWave
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/
|

04-24-2010, 01:33 AM
|
|
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
|

04-27-2010, 08:48 PM
|
|
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.
|

04-27-2010, 08:51 PM
|
|
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
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:50 PM.
|
|