On 2014-12-07 01:36, nik600 wrote:
Dear all

i've written a custom module to handle the cache of my CMS system.

Basically this module works in ap_hook_translate_name and decides
(following some custom logic) if the request can be served or not from the
cache.

If yes, the r->uri is changed to be served locally from my cache dir
if no, the r->filename is changed to be server from
a proxy:balancer://cluster config

In the ap_hook_log_transaction i'd like to compute the time of content
generation using:

float request_duration_sec=(float)(apr_time_now() -
r->request_time)/1000000;

Is this approach correct?

Is there any other hook more appropriate to do that?

Thanks all in advance.

Hello,

I think your approach is correct. However, have a look at the LogFormat directive. The %D directive might do exactly what you want and implemented in log_transaction.

Have a look at the RewriteCond and RewriteRule directives. The selective proxying could be implemented by these directives without writing any code.

E.g.:

<LocationMatch ^/your_url_pattern>
    RewriteEngine On
    RewriteCond ...
    RewriteCond ...
    RewriteRule .*  http://proxy/path?args keepalive=on [P]
</LocationMatch>

<Proxy http://proxy/path>
    ...
</Proxy>

I have not tried it with balancers but I think it works and the configuration is similar (balancer:// instead of http://).

Sorin


Bye


Reply via email to