fastcgi_cache_key and empty $content_type in cache

Maxim Dounin mdounin at mdounin.ru
Fri Apr 29 17:32:59 MSD 2011


Hello!

On Fri, Apr 29, 2011 at 06:22:39AM -0400, namesys wrote:

> Have a strange behavior of fastcgi cache, the variable $content_type
> does not passes to the cache KEY, configuration:

[...]

> But when I look into cache-file, the KEY field does not contain the
> content-type:
> .......
> KEY: 
> |GET|?|site_name|/system/files/imagecache/50x50/iconimage.png|http://site_name/
> .......
> Content-Type: image/png
> .......
> 
> As you see the content-type is visible in cache-file body, but it is not
> visible in the KEY field, it's just empty there. Does anybody knows why
> this happens?

Content-Type header you see in body is response content type 
(available as $upstream_http_content_type variable).  It can't be 
used in cache key though as it's not known before we have a
response.

Variable $content_type is *request* content type.  It's empty in 
most cases as requests usually doesn't have any content.

Maxim Dounin



More information about the nginx mailing list