Static Feed Caching
kus - October 11, 2007 - 16:03
| Project: | Boost |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Most of the traffic on my website is from the feeds (70%...podcasts).
I'd like to see static feed caching in the future.

#1
I vote for caching RSS also, because it IS possible to send static files with required header:
Content-Type: application/rss+xml
or
Content-Type: text/xml
when using Nginx webserver.
I plan to share my full Drupal+Boost+Nginx working configuration, soon, and adding cache for RSS (even for Nginx users) would be huge benefit.
#2
+1 Good ideea
#3
+1
#4
does the normal drupal cache pick up rss feeds?
#5
mikeytown2: Here is a related "answer" :) http://drupal.org/node/231424
#6
hmmm... What are all the possible url structures for feeds? Fairly sure it would have to support
application/rss+xml&text/xmlcontent-type mimes. In short a spec sheet is needed, so the degree of difficulty can be assessed.#7
with pathauto if you look int he pathauto table, every feed enabled stuff gets a "/feed" added to the end by default. At least for me for sure :)
#8
We can use the same boost commented footnote, so need to change the
// Output buffering callbackto correctly detect html & xml. Rewrite rules need to push out text/xml; (T=MIME-type) or ForceType. Cache all .xml extensions, all /feed paths. Add a setting to control this.#9
FYI The URL requests for XML sitemap data are always going to be
/sitemap(-\d+)?\.xml/i(PHP's preg format).#10
Fixed a bug with url aliass & subdir in this patch in boost_cache_expire_derivative() function. Patch should cache xml and feeds.
Rules
# BOOST START
<FilesMatch "\.(html.gz|html)$">
<IfModule mod_headers.c>
Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
</IfModule>
</FilesMatch>
<IfModule mod_mime.c>
AddCharset utf-8 .html
</IfModule>
<FilesMatch "\.(html.gz)$">
AddEncoding x-gzip .gz
ForceType text/html
</FilesMatch>
<FilesMatch "\.(xml.gz)$">
AddEncoding x-gzip .gz
ForceType text/xml
</FilesMatch>
#serve file IF it exist on server
RewriteCond %{REQUEST_FILENAME} \.\w{2,4}$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L]
#skip boost IF not get request OR uri has wrong dir OR cookie is set
RewriteCond %{REQUEST_METHOD} !^GET$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|themes|user/(login|password|register)))|(/(comment/reply|user)$) [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID
RewriteRule .* - [S=4]
#GZIP
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html.gz -f
RewriteRule .* cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html.gz [L]
RewriteCond %{DOCUMENT_ROOT}/cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.xml.gz -f
RewriteRule .* cache/gz/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.xml.gz [L,T=text/xml]
#NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html -f
RewriteRule .* cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html [L]
RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.xml -f
RewriteRule .* cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.xml [L,T=text/xml]
# BOOST END
#11
bug fix has been committed.
new patch incorporating new rules on the performance page.
#12
committed
#13
Automatically closed -- issue fixed for 2 weeks with no activity.