Hello! On Thu, Apr 22, 2021 at 04:51:59AM -0400, kkobylyanskiy wrote:
> I'm using Nginx as a reverse-proxy to cache my POST request and wrote the > following config: [...] > proxy_cache_key "$request_uri|$request_body"; [...] > client_body_buffer_size 512k; [...] > I'm getting the following error when trying so send a request for the second > time after the first on is cached: > > [crit] 20#20: *2 cache file > "/var/cache/nginx/6/fb/bee5677b8b46add7cfef279105773fb6" is too small > I logged in to the container and verified that this file contains cached > content. This is not going to work, since cache header is limited to 64k due to the unsigned short type being used in the on-disk format for header_start and body_start offsets. The cache header includes the cache key, which in you case can be up to 512k or even larger. Thanks for reporting this. This probably needs some explicit checks to fail in an obvious way instead of silently producing corrupted files and complaining later. To make this work, consider either limiting the request body to something less than 64k, or using a request body hash in the cache key instead of the full request body. The latter can be done using embedded perl or njs, see here: http://nginx.org/r/perl_set http://nginx.org/r/js_set -- Maxim Dounin http://mdounin.ru/ _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx