Hello everybody!

We have a Apache httpd with mod_cache/mod_disk_cache enabled. By default the 
directive CacheStaleOnError is activated. The documentation states:

| When the CacheStaleOnError directive is switched on, and when stale data is 
available in the cache, the cache will respond to 5xx responses from the 
backend by returning the stale data instead of the 5xx response.

That's our desired behaviour.

Additionally we want to serve a custom error page when there's no (stale) cache 
data add all to serve for a specific request. So we defined an ErrorDocument 
for every status of the 5xx class.

As I couldn't come up with an reliable test scenario, my question is: what will 
happen when cached data for a specific request is stale and a 5xx error occures 
while requesting the backend?

Our current configuration-template looks like that:

<VirtualHost *:80>
        ServerName @host@
        ServerAlias @hostShort@

        Include conf.cache/health-check.conf

        CustomLog logs/@host@/request_log \
                        "[%{%d/%m/%Y:%T}t.%{msec_frac}t %{%z}t] 
%{X-Forwarded-For}i %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %s %b %D 
\"%{User-Agent}i\" %{cache-hit}e"
        
        #htdocs
        ProxyPass /errors/ !
        ProxyPass /version/ !

        #BACKEND (defined in hosts.properties)
        ProxyPass / http://@backend@:80/
        ProxyPassReverse / http://@backend@:80/
        
        CacheRoot /var/local/cache/@host@/
        
        # Serve stale data on error.
        CacheStaleOnError on 
        
        Include conf.cache/cache-common.conf
        Include conf.cache/cache-rules.conf
        Include conf.cache/ssl-cache-rules.conf

        ProxyErrorOverride On
        
        ErrorDocument 500 /errors/@host@.html
        ErrorDocument 501 /errors/@host@.html
        ErrorDocument 502 /errors/@host@.html
        ErrorDocument 503 /errors/@host@.html
        ErrorDocument 504 /errors/@host@.html
        ErrorDocument 505 /errors/@host@.html
        ErrorDocument 506 /errors/@host@.html
        ErrorDocument 507 /errors/@host@.html
        ErrorDocument 508 /errors/@host@.html
        ErrorDocument 510 /errors/@host@.html

</VirtualHost>

Does httpd serve the stale data? Or does it serve the configured custom error 
page? How is that prioritised?

Thanks in advance,
Alexander

--
Alexander Härtig
software engineer

dmc 030 GmbH
Kohlfurter Strasse 41/43
10999 Berlin (Germany)
Telefon: +49 30 308 3393 - 70
Telefax: +49 30 308 3393 - 93
E-Mail: alexander.haer...@dmc.de
Internet: www.dmc.de

Handelsregister: AG Berlin Charlottenburg HRB 129396 B
Geschäftsführer: Daniel Elsässer, Andreas Magg
---------------------------------------------
// the diconium companies:
dmc commerce consultants | dmc digital media center | dmc 030 | ro11 | embitel 
| CINTEO

stuttgart // berlin // karlsruhe // bangalore // detroit 
---------------------------------------------

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie 
nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, 
informieren 
Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte 
Kopieren 
und die unbefugte Weitergabe dieser E-Mail sind nicht gestattet. 

This e-mail may contain confidential and/or privileged information. If you are 
not the intended 
recipient or have received this e-mail in error please notify the sender 
immediately and delete 
this e-mail. Any unauthorized copying, disclosure or distribution of the 
material in this e-mail 
is strictly forbidden.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to