using commit:apphost for errorpages
execute flush only if needed