Setting a very high max-age value for Cache-Control causes int overflow
|Reported by:||Owned by:|
|uname -a:||Tested on Windows|
|nginx -V:||nginx version: nginx/1.20.2|
When proxying to a ruby on rails application, it is possible to receive 100 years (in seconds) as the max age value for the purpose of caching the response forever. In such cases, when nginx parses the value, it ends up being negative thus marking all cache responses as
According to the spechttps://datatracker.ietf.org/doc/html/rfc7234#section-1.2.1
the cache must consider the value to be either 2147483648 (2^31) or the greatest positive integer it can conveniently represent
I think the issue might be somewhere near https://github.com/nginx/nginx/blob/master/src/http/ngx_http_upstream.c#L4761 .