Re: configuring disk cache look-up before proxying

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

 



Hi Eric,

On Wed, Nov 26, 2008 at 2:44 PM, Eric Covener <covener@xxxxxxxxx> wrote:
> On Wed, Nov 26, 2008 at 4:40 PM, Peter Michaux <petermichaux@xxxxxxxxx> wrote:
>
>> The back end server caches files in two different places and I would
>> like Apache to look in those two places and only proxy if the cached
>> file cannot be found. For example, a request to
>
> Insead of ProxyPass, use mod_rewrite to poke around in the filesystem:
>
> RewriteCond /var/cache/app/%{HTTP_HOST}/%{REQUEST_URI}  -f
> RewriteRule .*  /var/cache/app/%{HTTP_HOST}/%{REQUEST_URI}  [L]
>
> RewriteCond /var/cache/otherapp/%{HTTP_HOST}/%{REQUEST_URI}  -f
> RewriteRule .*  /var/cache/otherapp/%{HTTP_HOST}/%{REQUEST_URI}  [L]
>
> # couldn't find the file in either dir
> RewriteRule ^/(.*) http://localhost:3000/$1 [P]
>
> Or, let Apache cache things instead of writing them to disk, and it
> would be more transparent.
>
> (Note that you need to put the rewrite stuff in per-vhost context,
> otherwise it won't work as-is. You also probably want to handle
> directories if that makes sense for your app (-d))

Thanks for this. I was able to piece together what I needed with your
above idea and some more documentation reading. It seems the [P] uses
mod_proxy and so ProxyPreserveHost is still honoured with the rewrite
rule to localhost:3000.

Thanks,
Peter

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