Is there a timeout setting in a Caddy that will stop request execution after 60 seconds?
Currently, I have a timeout
set on the client side that is equal to 70 seconds, so before the client side cut-off request, I want to give PHP or Caddy 10 seconds to cut off execution on the server side properly. I have max_execution_time
equal to 60 seconds on PHP side but it’s clock CPU time if I’m not mistaken and I can see that sometimes Maximum execution time of 60 seconds exceeded
faired not after 60 but after 70 or 80 seconds. So I want to also have some timeout on the Caddy side that will stop execution and return 504 probably??? after 65 seconds. So if the script is handled for more than 60 seconds and not stopped by PHP, let’s stop it by the Caddy, and as the last resort by the client.
I see Caddy has 4 timeouts
timeouts🔗
read_body - is a duration value that sets how long to allow a read from a clients upload. Setting this to a short, non-zero value can mitigate slowloris attacks, but may also affect legitimately slow clients. Defaults to no timeout.
read_header - is a duration value that sets how long to allow a read from a clients request headers. Defaults to no timeout.
write - is a duration value that sets how long to allow a write to a client. Note that setting this to a small value when serving large files may negatively affect legitimately slow clients. Defaults to no timeout.
idle - is a duration value that sets the maximum time to wait for the next request when keep-alive's are enabled. Defaults to 5 minutes to help avoid resource exhaustion.
but it’s not clear to me, which one I need to use
I’d say you’re looking for request_body
, but personally I’d set each of them there.
My assumption is based on v1 Caddy, where handles were named differently and request_body
was read
and its description is
Read: Maximum duration for reading the entire request, including the body.