feat(gateway): configurable fallback timeout for the gateway handler#1079
Merged
Conversation
gammazero
commented
Dec 13, 2025
|
|
||
| // MaxRequestDuration per-request timeout for the gateway handler. It | ||
| // defaults to DefaultMaxRequestDuration. | ||
| MaxRequestDuration time.Duration |
Contributor
Author
There was a problem hiding this comment.
Does this need to be a duration string that can be parsed (e.g. "1h")?
Member
There was a problem hiding this comment.
That is up to the user of boxo/gateway library.
Prior art (RetrievalTimeout time.Duration) in Kubo is wired in a way that support human-readable strings, but that is userland decision, we dont do that in boxo here.
Added a configurable fallback timeout for the gateway handler, defaulting to 1 hour. Configurable via `MaxRequestDuration` in the gateway config. Replaces #1069
110dc2d to
8e2e90a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1079 +/- ##
==========================================
- Coverage 61.14% 61.08% -0.06%
==========================================
Files 264 264
Lines 26227 26231 +4
==========================================
- Hits 16036 16024 -12
- Misses 8515 8525 +10
- Partials 1676 1682 +6
... and 11 files with indirect coverage changes 🚀 New features to boost your workflow:
|
- fix typo in error message (MaxRequestDuratio -> MaxRequestDuration) - clarify difference between MaxRequestDuration and RetrievalTimeout - document that zero/negative values use the default
- add unit tests for validateConfig with MaxRequestDuration - add integration test verifying timeout behavior with slow backend - add slowMockBackend that respects context cancellation
lidel
approved these changes
Jan 9, 2026
lidel
added a commit
to ipfs/kubo
that referenced
this pull request
Jan 9, 2026
exposes the previously hardcoded 1 hour gateway request deadline as a configurable option, allowing operators to adjust it to fit deployment needs. protects gateway from edge cases and slow client attacks. boxo: ipfs/boxo#1079
lidel
added a commit
to ipfs/kubo
that referenced
this pull request
Jan 15, 2026
* feat(config): add Gateway.MaxRequestDuration option exposes the previously hardcoded 1 hour gateway request deadline as a configurable option, allowing operators to adjust it to fit deployment needs. protects gateway from edge cases and slow client attacks. boxo: ipfs/boxo#1079 * test(gateway): add MaxRequestDuration integration test verifies config is wired correctly and 504 is returned when exceeded * docs: add MaxRequestDuration to gateway production guide --------- Co-authored-by: Andrew Gillis <11790789+gammazero@users.noreply.github.com>
phaseloop
pushed a commit
to phaseloop/boxo
that referenced
this pull request
Mar 3, 2026
…pfs#1079) * add configurable fallback timeout for the gateway handler Added a configurable fallback timeout for the gateway handler, defaulting to 1 hour. Configurable via `MaxRequestDuration` in the gateway config. Replaces ipfs#1069 * fix(gateway): typo and improve MaxRequestDuration docs - fix typo in error message (MaxRequestDuratio -> MaxRequestDuration) - clarify difference between MaxRequestDuration and RetrievalTimeout - document that zero/negative values use the default * test(gateway): add tests for MaxRequestDuration config - add unit tests for validateConfig with MaxRequestDuration - add integration test verifying timeout behavior with slow backend - add slowMockBackend that respects context cancellation --------- Co-authored-by: Marcin Rataj <lidel@lidel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a configurable fallback timeout for the gateway handler, defaulting to 1 hour. Configurable via
MaxRequestDurationin the gateway config.Replaces #1069