MAGE-471: added check, which skips caching headers if messages should be printed on current page
- reverted commit committed by mistake to the master branch