upstream request timeout
A request to the tunnel hangs without a response for a long time, and then a short plain-text response arrives. The text and status depend on where the timeout fired:
upstream request timeout
stream timeout
net/http: timeout awaiting response headers
Causeโ
The service behind the tunnel accepted the request but takes too long to respond. Tuna doesn't hold such a request forever:
upstream request timeout, status504โ the Tuna edge server didn't see the response start in time. Regular HTTP tunnels may have a one-minute limit on the start of the response. The file server, WebDAV, 1C, and Kubernetes tunnels have no such limit: long responses are normal for them.stream timeout, status408โ the service sent not a single byte for 3 hours and never started responding. This is the idle limit of an HTTP tunnel. The total request duration isn't limited: as long as data keeps flowing, the connection stays open.net/http: timeout awaiting response headers, status502โ the service of an app in proxy mode didn't start responding within 30 seconds. This is the default; you can change it for an app with theresponse_timeoutfield in the API.
If the connection to the service drops before the response, you may get a 503 with the text upstream connect error or disconnect/reset before headers instead of a timeout.
What to doโ
- Check that the service responds locally and doesn't hang on this request:
curl -v http://localhost:3000/path. - Move long operations โ report generation, exports, file processing โ to the background: respond right away that the job is accepted, and return the result in a separate request.
- For long streaming responses, send data or the response headers right away rather than at the very end, for example with Server-sent events.
If the tunnel isn't yours and someone sent you the link, retry the request later or contact whoever sent it.