httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy F." <>
Subject [users@httpd] Rails asset pipeline
Date Tue, 01 May 2012 19:22:45 GMT
I've submitted a pull request to the rails guide to request a specific
configuration for apache to use the so-called "asset pipeline" feature
of Rails 3.1.  The rails app concatenates and compresses javascript
and CSS files, and the rails guide has no method of apache config.
Before accepting the pull request, the guide's owner would like peer
review on the apache mailing list of the config, to ensure it is
stable, and a best practice.

The last line of
"A robust configuration for Apache is possible but tricky; please
Google around. (Or help update this Guide if you have a good example
configuration for Apache.)"

My pull request can be viewed here:

Would anybody be able to take a look at the request and provide feedback?

This is the end result of the config on my server:

AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz

# Set rewrite engine to check if the client can accept gzip files
# and a gzipped copy of the requested file exists.
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule (.*\.(js|css))$ $1\.gz [L]

# If we've rewritten to a .css.gz file, force text/css
<FilesMatch .*\.css.gz>
  ForceType text/css

# If we've rewritten to a .js.gz file, force application/x-javascript
<FilesMatch .*\.js.gz>
  ForceType application/x-javascript

<LocationMatch "^/assets/.*$">
  # Some browsers still send conditional-GET requests if there's a
  # Last-Modified header or an ETag header even if they haven't
  # reached the expiry date sent in the Expires header.
  Header unset ETag
  Header unset Last-Modified
  FileETag None
  # RFC says only cache for 1 year
  ExpiresActive On
  ExpiresDefault "access plus 1 year"

source reference:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message