Problem solved. I've created a regex that matches bot app.php
/app_dev.php
and png|jp[e]g|gif
etc. Now images are cached as requested. If an Image was not generated the server responses with 201 Created
and afterwards with either 200 Ok
or 304 Not Modified
depending on wether it was cached before or not.
Here is my corresponding nginx config:
location ~ ^/(app_dev|app)\.php(.*?)\.(?:ico|gif|jpe?g|png)$ {
expires 18h;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
# still redirect because we are using LiipImagineBundle!
include fastcgi_params;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
# more static files:
location ~* \.(?:css|js)$ {
expires 18h;
add_header Cache-Control "publi, must-revalidate, proxy-revalidate";
access_log off;
}
location ~ ^/(app_dev|app)\.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
I hope this helps.