certify icon indicating copy to clipboard operation
certify copied to clipboard

Retry-After header does not seem to be honored

Open chielteuben opened this issue 8 months ago • 2 comments

While testing the order process today I noticed that the certificate request timed out within 30 seconds after hitting finalize despite the ACME server indicating a Retry-After value of 5 in it's header and the order status still being 'processing'. While digging in the code I saw 10 attempts will be made and, if the Retry-After header is set, it will delay each task attempt by the given value. It should then be impossible to time out after only 30 seconds when the Retry-After header is set to 5 right?

Now I didn't dive into Anvil but is it possible that the 'RetryAfter' value isn't properly propagating and simply isn't set?

chielteuben avatar Mar 27 '25 14:03 chielteuben

For further context, when looking at AnvilACMEProvider.cs and it's usage of orderContext.RetryAfter I do not see how Anvil's OrderContext, and specifically Anvil's EntityContext , has it's RetryAfter property set, if ever.

chielteuben avatar May 07 '25 11:05 chielteuben

Hi, thanks for raising this issue. Currently the retry logic is split across the provider and the anvil library with some retries happening based on Retry-After, but not universally. There's also a need for some upper limit because if a server says retry after 5 minutes we should quit the order and just try again later rather than actually sleep for 5 minutes, as our renewal checks have a 5minute resolution anyway.

We do need to improve this but in the meantime if you have a slow ACME service you can work around that by setting DefaultACMERetryInterval in C:\ProgramData\certify\appsettings.json to a value like 30 (meaning 30 seconds wait between ACME operation retries), the default is only a few seconds wait between retries.

Our of interest what ACME service was this (or if internal, which ACME server software).

webprofusion-chrisc avatar Jun 24 '25 07:06 webprofusion-chrisc