Set Timeout on FHIR Server/Rest Operations

Is there a way to set a timeout on all rest operations that come through the FHIR server? We’re using custom operations and we want to make sure that these operations do not take longer than 8 seconds.

There’s no way for a client to specify a timeout - though it can always stop paying attention and stop blocking if the server isn’t sofficiently timely. A server should be able to configure a timeout within their software, but that’s outside FHIR’s scope and will depend on the server technology. Note that timing out early (and failing) doesn’t necessarily result in a better client experience, depending on what the client needs to do in the event of a failure.

Our code is behind a gateway that we don’t control. That gateway times out at 9 seconds with a non-FHIR response. We were hoping there was a way to set a timeout on the FHIR server side, so that we could return a FHIRized 504 message before the gateway times out.

There may well be, but that will be specific to the server, it’s not something defined by the FHIR specification. You could raise it as a question with the developers of whatever FHIR server you’re using. If you’ve written your own server, you’ll need to handle it yourselves.