proxy_cache control via HTTP/2 trailing headers

Claudiu jazzman at
Mon Dec 28 22:49:23 UTC 2020


I'm wondering if there is a way to instruct nginx to cache or not a 
backend response based on trailing headers?

Use-case is that backend does some heavy longer running streaming work 
that in some edge cases may fail midway. As the response is already 
streaming I need to tell nginx to not cache that response as it is 
failed. Status code is already sent and I don't think I can change it 
later via trailing headers, thus, proxy_cache_valid directive seems of 
no use. However, docs mention the X-Accel-Expires header that 
technically could be sent as trailing header. What I don't know yet is 
if nginx supports X-Accel-Expires as trailing header or if it supports 
trailing headers in backend responses at all.

Or, is there another way to accomplish something like this?


More information about the nginx mailing list