[SOLVED] compression not working on combined JS file

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

[SOLVED] compression not working on combined JS file

Post by rotezecke »

this is not really a CMSMS question but maybe someone stumbled over this:
i finally got around trying Rolf's "combine javascript on the fly" idea
https://www.cmscanbesimple.org/blog/eas ... s-and-code
(thanks Rolf - working fine).
i couldnt use the suggested naming convention (combined_file.js) as this didnt work on https (long story but that was expected) hence I ended up using the page alias:

Code: Select all

<__script__ type="text/javascript" src="?page=javascript"> 
this works nicely on all pages, incl. third party e-commerce CMS. only thing failing is server-side compression which looks like this:

Code: Select all

<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4.0[678] no-gzip
  BrowserMatch ^MSIE !no-gzip !gzip-only-text/html
</ifModule>
how can i tell apache that this file "?page=javascript" should be treated like a regular JS file?

server runs Apache/2.2.27 (Unix)
website "http://www.rpc.com.au"

Thanks.
Last edited by rotezecke on Tue Sep 23, 2014 5:46 am, edited 1 time in total.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

Re: compression not working on combined JS file

Post by rotezecke »

i added this

Code: Select all

<FilesMatch "index\.php$">
       SetOutputFilter DEFLATE
</FilesMatch>
and surprisingly this works even though in CMSMS this probably matches every page. but so far so good.
Post Reply

Return to “The Lounge”