Skip to content

Conversation

@bastikohn
Copy link

Main motivation: Allow self-hosted instances to configure the maximum duration for long-running HTTP requests (notably file uploads).

This PR makes the local backend’s HTTP request timeout configurable via HTTP_SERVER_TIMEOUT_SECONDS by standardizing on the shared HTTP_SERVER_TIMEOUT_DURATION knob.

Changes

  • Plumb HTTP_SERVER_TIMEOUT_DURATION into both HTTP servers started by local-backend:
    • Main backend listener (API + storage upload endpoints): main.rs
    • Dev site proxy listener (HTTP Actions proxy): proxy.rs
  • Adjust the knob default from 300s → 125s in knobs.rs so the knob matches the prior local-backend hardcoded behavior (i.e. no default behavior change for local backend unless the env var is set).
  • Expose HTTP_SERVER_TIMEOUT_SECONDS in self-hosted Docker Compose so operators can override it.

Behavior

This timeout is enforced by tower_http::timeout::TimeoutLayer, so it bounds end-to-end request processing time (including time spent receiving an upload body). Requests exceeding the duration will return "408 Request Timeout".
Increasing HTTP_SERVER_TIMEOUT_SECONDS increases the maximum allowed duration for uploads to /api/storage/upload and any long-running HTTP Action requests going through the local backend/proxy.

Testing

Manual verification: start the backend with a low/high HTTP_SERVER_TIMEOUT_SECONDS and confirm long uploads fail/succeed accordingly. (I have verified this using a local build of the backend container.)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant