Browse Source

Serve cached attachments directly from cache

release/0.6.4
Robin Houston 9 years ago
parent
commit
84db0d65b7
  1. 13
      config/httpd.conf
  2. 1
      public/views_cache

13
config/httpd.conf

@ -32,6 +32,19 @@ RequestHeader add X-Forwarded-User %{RU}e
# files for archiving.
RewriteRule /files/(.+) http://files.whatdotheyknow.com/$1
# Serve attachments directly from the cache, if possible.
#
# The file names are URL-encoded on disk, and sharded by the first
# three digits of the request id, which is why this is as complicated
# as it is. The RewriteMap directive makes the URL-escaping function
# available to use in the other directives.
#
# The condition means that the rule will fire only if the cached
# file exists.
RewriteMap escape int:escape
RewriteCond %{DOCUMENT_ROOT}/views_cache/request/$2/$1/${escape:$3} -f
RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/\d+/.+) /views_cache/request/$2/$1/${escape:$3} [L]
<IfModule mod_passenger.c>
# Set this to something like 100 if you have memory leak issues
PassengerMaxRequests 20

1
public/views_cache

@ -0,0 +1 @@
../cache/views
Loading…
Cancel
Save