symfony/symfony — Issue #2623: Wrong Content-Length header
Author: innocead
Created: 2011-11-11 18:36:47+00:00
State: open

When i use full page cache with some standalone blocks (cache also enabled), Symfony set wrong Content-Length header to response.

class ArchiveController extends Controller {

/**
* @Template
* @Cache(smaxage="3600")
*/
public function indexAction()
{
return array();
}
}

If i add to app.php this code, when works fine:

//app.php
$response = $kernel->handle(Request::createFromGlobals());
$response->headers->set('Content-Length', strlen($response->getContent()));
$response->send();

i use nginx + php-fpm on centos 5.7. Varnish not be used.

server
{
index app.php index.html index.htm;

location / {
try_files $uri $uri/ @rewrite;
}

location @rewrite {
rewrite ^/app_dev.php/(.*)$ /app_dev.php last;
rewrite ^/(.*)$ /app.php last;
}

location ~* ^.+\.php$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index app.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass_header Last-Modified;
}

location ~* ^.+\.(jpg|jpeg|gif|css|png|js|xml|ico)$
{
expires 30d;
access_log off;
}
}