Nginx caching no header content-length

Vikas Parashar para.vikas at
Wed Mar 2 17:03:34 UTC 2016

Thanks for your promot response.

   location /xxxxx {

error_log /var/log/nginx/contenttroubleshooterror.log debug;
#chunked_transfer_encoding off;
#proxy_http_version 1.1;
#proxy_buffering on;
#proxy_pass_header Content-Length;

proxy_pass http://tomcat:8080/xxxxx;

   proxy_cache my_cache;

   # Adding a header to see the cache status in the browser
   add_header X-Cache-Status $upstream_cache_status;
# sub_filter_last_modified on;
#add_header 'Content-Length' $upstream_http_content_length;
#add_header 'Content-Length' 12312;

   proxy_cache_key "$scheme$request_uri $http_x_seneca_uid";
   proxy_cache_min_uses 1;
   proxy_cache_valid 200 302 120m;
   proxy_cache_valid 404 1m;
   proxy_cache_use_stale error timeout invalid_header http_500 http_502
http_503 http_504;

don't know how to do it.  Could you please let me know, how to add header
like add_header 'Content-Length' $upstream_http_content_length;


add_header 'Content-Length' 12312312

Static value is working fine. But at the moment, i replaced it from

it did not work. Any Luck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list