Use Case: You want to serve cached content if all the renderer in dispatcher.any is unavailable
Prerequisite: You need dispatcher version 4.1.0. You can download latest dispatcher from package share. You can also connect to Day Care to get latest dispatcher release.
Problem: Currently If all renderer is unavailable, You get "502 Bad response code". It might possible that all your pages are already cached before render went down. It will make sense to serve cached content in that case.
Solution: You can use following parameter in dispatcher.any for this,
/ServeStaleOnError "1"
You have to restart apache after making changes. You can add this tag any where at /website level. So it should be,
/farms
{
# first farm entry (label is not important, just for your convenience)
/website
{
Prerequisite: You need dispatcher version 4.1.0. You can download latest dispatcher from package share. You can also connect to Day Care to get latest dispatcher release.
Problem: Currently If all renderer is unavailable, You get "502 Bad response code". It might possible that all your pages are already cached before render went down. It will make sense to serve cached content in that case.
Solution: You can use following parameter in dispatcher.any for this,
/ServeStaleOnError "1"
You have to restart apache after making changes. You can add this tag any where at /website level. So it should be,
/farms
{
# first farm entry (label is not important, just for your convenience)
/website
{
....
/ServeStaleOnError "1"
}
}
If you want to serve custom error page if pages are not cached. Feel free to modify httpd.conf and add following line to it,
ErrorDocument 502 <Path for custom 502 page>
This is true for any error page. More information can be found here http://httpd.apache.org/docs/2.0/mod/core.html#errordocument
If you are using this make sure that DispatcherPassError is set to 0. More information about this can be found here,
You can also handle 5XX error effectively by adjusting following params in dispatcher.any
/health_check { # Page gets contacted when an instance returns a 500 } /retryDelay "1" /numberOfRetries "5" /unavailablePenalty "1"
Again You can find more information about it on Day Doc.
Another cool thing you can do with latest dispatcher is, You can use * for client header section, So that you don't have to add all entry. Something like
/clientheaders {*}
Feel free to comment if something is not clear.