Hi!
Update. I have solved as follows:
if ( $http_user_agent !~* (Wget|Googlebot|bingbot|YandexBot|msnbot) ) {
set $not_bot "1";
}
location ~* \.(html)$ {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache cache_one;
proxy_ignore_headers Set-Cookie Cache-Control Expires;
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_cache_bypass $not_bot; #skip caching
proxy_no_cache $not_bot; #skip caching
proxy_cache_valid 200 304 30m;
proxy_cache_key $host$uri$is_args$args;
expires 336h;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 120;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_pass http://myapachecluster;
}
I hope it helps someone ;-)
Thank you.