# Fastcgi cache bypass empty body

**URL:** <https://www.ruby-forum.com/t/fastcgi-cache-bypass-empty-body/215508>\
**Category:** NGINX\
**Created:** [January 6, 2012, 9:53am UTC](https://www.ruby-forum.com/t/fastcgi-cache-bypass-empty-body/215508 "2012-01-06T09:53:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 6, 2012, 9:53am UTC](https://www.ruby-forum.com/t/fastcgi-cache-bypass-empty-body/215508/1 "2012-01-06T09:53:37Z")

</div>

Hi All,  
currently we are using nginx with fastcgi\_cache with php backend. For  
some conditions php returns an empty body (that we can not find the  
cause) but sends some headers and nginx thinks it is valid. So it stores  
the file which results to an empty response for upcoming requests.

Cached response from backend is attached, is there a configuration  
option to prevent this?

p.s. I changed the site name to in attachment.

---

<div class="post-metadata">

**Author:** ![SSAnSSl\_SSetinSS\_SS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@SSAnSSl\_SSetinSS\_SS](https://www.ruby-forum.com/u/SSAnSSl_SSetinSS_SS)\
**Post date:** [January 6, 2012, 12:21pm UTC](https://www.ruby-forum.com/t/fastcgi-cache-bypass-empty-body/215508/2 "2012-01-06T12:21:21Z")

</div>

On 6 Jan 2012 08h52 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All, currently we are using nginx with fastcgi\_cache with php  
> backend. For some conditions php returns an empty body (that we can  
> not find the cause) but sends some headers and nginx thinks it is  
> valid. So it stores the file which results to an empty response for  
> upcoming requests.

Perhaps using the embedded Lua module you can capture the response  
and, for example, set ‘X-Accel-Expires: 0’, header for that request or  
set a variable that is evaluated by fastcgi\_cache\_bypass.

then define:

fastcgi\_cache\_bypass $no\_cache;

Check: [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpLuaModule#rewrite_by_lua)

— appa

---

<div class="post-metadata">

**Author:** ![SSAnSSl\_SSetinSS\_SS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@SSAnSSl\_SSetinSS\_SS](https://www.ruby-forum.com/u/SSAnSSl_SSetinSS_SS)\
**Post date:** [January 8, 2012, 1:50pm UTC](https://www.ruby-forum.com/t/fastcgi-cache-bypass-empty-body/215508/3 "2012-01-08T13:50:05Z")

</div>

Hello!

On Fri, Jan 06, 2012 at 10:52:37AM +0200, Anıl Çetin wrote:

> Hi All,  
> currently we are using nginx with fastcgi\_cache with php backend. For  
> some conditions php returns an empty body (that we can not find the  
> cause) but sends some headers and nginx thinks it is valid. So it stores  
> the file which results to an empty response for upcoming requests.
> 
> Cached response from backend is attached, is there a configuration  
> option to prevent this?

No, there is no such option.

Maxim D.
