How to check that $request_body has some string and use it like a caching key?

Hi everybody,

I have the following situation:

Incoming request with method POST has binary body. I would like to
extract piece(s) from the payload to use it like a caching key.

Something like:

if ( $request_body ~* (action.*) ) {
set $key $1;
}

proxy_cache_key $uri|$key

Unfortunately it does not work for me even if I specified (like Igor
advised):

client_max_body_size 1k;

I also tried client_body_buffer_size 1k; but it did not help either.

In the error.log with debug on I can see that $request_body has value,
but it never matches my condition, so $key is always empty.

Just in case I’m repeating, that request_body is binary. It has 0x00 as
well as everything else. It is AMF data.

Any advices?

Thanks
—>>> qzpmwo <<<—

Posted at Nginx Forum: