Page 1 of 1

[SOLVED] compression not working on combined JS file

Posted: Tue Sep 23, 2014 4:52 am
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.

Re: compression not working on combined JS file

Posted: Tue Sep 23, 2014 5:45 am
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.