Pre compressed css and javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have configured my httpd instance to serve pre-compressed css and
java script. But I have two issues.

My httpd configuration is as follows.

RewriteEngine On
RewriteLog "logs/rewrite.log"
RewriteLogLevel 5

AddEncoding gzip .gz

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari

# is the request for a js or css file?
RewriteCond %{REQUEST_FILENAME} ^(.*).(js|css)$
# is there a gziped version of the file?
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]

Issue 1 is that the last RewriteCond never matches even though I can
request the gz version directly from the browser. Odly I have no non
gzipped version of the file on the server so requesting it results in
me being served the gzipped version.

192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(2) init rewrite engine with requested uri /southwesttrains/main.css
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(3) applying pattern '/favicon.ico' to uri '/southwesttrains/main.css'
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(3) applying pattern '^(.*)$' to uri '/southwesttrains/main.css'
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(4) RewriteCond: input='gzip,deflate' pattern='gzip' => matched
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(4) RewriteCond: input='/southwesttrains/main.css'
pattern='^(.*).(js|css)$' => matched
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(4) RewriteCond: input='/southwesttrains/main.css.gz' pattern='-f' =>
not-matched
192.168.1.46 - - [04/Oct/2010:14:25:34 +0100]
[www.journeycheck.southwesttrains.co.uk/sid#973c5d8][rid#98ab4c0/initial]
(1) pass through /southwesttrains/main.css


Issue 2 is that although the browser has the following warning when
loading the page.

FireFox:

Warning: The stylesheet
http://www.journeycheck.southwesttrains.co.uk/southwesttrains/main.css
was loaded as CSS even though its MIME type, "application/x-gzip", is
not "text/css".
Source File: http://www.journeycheck.southwesttrains.co.uk/southwesttrains/index.html
Line: 0

Chrome:

Resource interpreted as stylesheet but transferred with MIME type
application/x-gzip.


Any help would be appreciated.

Regards

Ben

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux