RE: Combining caching and rewrites

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

 



Wi,

Apache mod_cache hooks itself before mod_rewrite (APR_HOOK_FIRST vs.
APR_HOOK_MIDDLE), so the cache will get called first, if content doesn't
exist, request will be passed to next handler which is mod_rewrite,
which will handle getting the page, then Apache will CACHE_SAVE the
response so that next time the same page is requested mod_cache will
serve the content from the cache without passing it to mod_rewrite (of
course with respect to cache control directives).

Thanks,
Tamer

-----Original Message-----
From: wi [mailto:icebattle@xxxxxxxxx]
Sent: Wednesday, November 26, 2008 3:20 AM
To: users@xxxxxxxxxxxxxxxx
Subject:  Combining caching and rewrites

Hi All

I have a response from an expensive backend service that I would like
to cache. We already do some caching of static content, and that works
fine. However, the response that I want to cache is normally generated
by a rewrite (the last three lines below). So, if I add some caching
directives, I get the following. Is this likely to work? How does the
result of the rewrite wind up in the cache?

(What I'm probably asking is how the response is handled after generation...)

   <IfModule mod_disk_cache.c>
      CacheIgnoreCacheControl On
      CacheDefaultExpire 300
      CacheIgnoreNoLastMod On
      CacheStoreNoStore On
      CacheStorePrivate On
      CacheRoot /caches/tmp/dbgen
      CacheEnable disk /expstuff
  </IfModule>
  RewriteCond %{REQUEST_METHOD} GET
  RewriteCond %{REQUEST_URI} ^/expstuff
  RewriteRule ^/(.*) http://xx.xx.xx.xx:7777/$1 [P,NE,L]


--
Cheers
Wayne

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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