Welcome! Log In Create A New Profile


fastcgi_cache_key and empty $content_type in cache

April 29, 2011 06:22AM
Have a strange behavior of fastcgi cache, the variable $content_type does not passes to the cache KEY, configuration:
location ~ \.php$ {
fastcgi_cache cache;
fastcgi_cache_key "$content_type|$request_method|$is_args|$host|$request_uri|$http_referer";
fastcgi_cache_valid any 60m;
fastcgi_cache_use_stale error timeout invalid_header http_500 http_503;
fastcgi_ignore_headers "Set-Cookie" "Cache-Control" "Expires";
fastcgi_pass_header "Set-Cookie";

fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffers 4 128k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_param SCRIPT_FILENAME /var/www/site_folder$fastcgi_script_name;

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?

Thank you for your advices.
Subject Author Posted

fastcgi_cache_key and empty $content_type in cache

namesys April 29, 2011 06:22AM

Re: fastcgi_cache_key and empty $content_type in cache

Maxim Dounin April 29, 2011 09:34AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready