Default answer at proxy timeout

Hi together,

we have a nginx Server serving our requests. Based on our SLAs we need
to answer always in 7ms time. Behind the nginx Server, there is a Java
Backend, which we proxy through the nginx.

The requirement is saying, that in case we can not deliver our answer in
7ms, we need to respond with an empty String „\n“.

Is there a ways to configure nginx in that way, that after the 7ms
timeframe it will not wait for the backend systems answer but respond
with this empty String?

Thanks for your help

​ginx provides​
However, as documentation states, the timeout is set between messages,
so a
fragmented answer which takes less than the timeout for each part will
You also have proxy_connect_timeout
and proxy_send_timeout
directives, if those are more suitable to you.

To craft a custom answer, I would use:
​error_page 504 @backend_timeout;
in the proxied location, associated with:
location @backend_timeout {
return 200 “\n”;

B. R.