httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <>
Subject [users@httpd] Pre compressed css and javascript
Date Mon, 04 Oct 2010 13:31:25 GMT

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. - - [04/Oct/2010:14:25:34 +0100]
(2) init rewrite engine with requested uri /southwesttrains/main.css - - [04/Oct/2010:14:25:34 +0100]
(3) applying pattern '/favicon.ico' to uri '/southwesttrains/main.css' - - [04/Oct/2010:14:25:34 +0100]
(3) applying pattern '^(.*)$' to uri '/southwesttrains/main.css' - - [04/Oct/2010:14:25:34 +0100]
(4) RewriteCond: input='gzip,deflate' pattern='gzip' => matched - - [04/Oct/2010:14:25:34 +0100]
(4) RewriteCond: input='/southwesttrains/main.css'
pattern='^(.*).(js|css)$' => matched - - [04/Oct/2010:14:25:34 +0100]
(4) RewriteCond: input='/southwesttrains/main.css.gz' pattern='-f' =>
not-matched - - [04/Oct/2010:14:25:34 +0100]
(1) pass through /southwesttrains/main.css

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


Warning: The stylesheet
was loaded as CSS even though its MIME type, "application/x-gzip", is
not "text/css".
Source File:
Line: 0


Resource interpreted as stylesheet but transferred with MIME type

Any help would be appreciated.



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message