For the last few months I’ve been having sporadic issues with blank pages being served from my web server.
I’d get emails mostly, but sometimes I’d see them myself. And as soon as I cleared the cache everything would be fine. For a while. Then a day or two later I’d get another email saying a page was blank.
Pingdom was also showing the “outages”, but I could never find the cause.
Well, I just found it. It has to do with the caching setting in Nginx. When you define what to cache you have the option of defining the HTTP method along with it, which will differentiate between HEAD and GET requests.
The issue was that pages were being pulled with HEAD, and then cached, and as we all know, HEAD requests don’t return a body. So whenever that happened I was caching and serving blank pages.
Configuring your fastcgi_cache_key
Here’s the configuration line to make it work:
I put this in place a few days ago and haven’t had a blank page served since.
Hope this helps.