Timeouts & Redirects
Timeouts
Section titled “Timeouts”Connection Timeout
Section titled “Connection Timeout”Use --connect-timeout to set the maximum time for establishing a connection:
orb --connect-timeout 5 https://example.comDefault: 10 seconds
This timeout covers:
- DNS resolution
- TCP connection establishment
- TLS handshake
Total Request Timeout
Section titled “Total Request Timeout”Use -m or --max-time to set the maximum total request time:
orb -m 30 https://example.comThis timeout covers the entire request, from start to finish, including:
- Connection establishment
- Sending the request
- Receiving the response
Timeout Examples
Section titled “Timeout Examples”# Quick health check - fail fastorb --connect-timeout 2 -m 5 https://api.example.com/health
# Allow time for large downloadorb -m 300 https://example.com/large-file.zip -o file.zip
# Slow server, generous timeoutsorb --connect-timeout 30 -m 120 https://slow-server.example.comRedirects
Section titled “Redirects”By default, orb does not follow HTTP redirects (3xx responses).
Follow Redirects
Section titled “Follow Redirects”Use -L or --location to follow redirects:
orb -L https://httpbin.org/redirect/3This will follow up to 10 redirects by default.
Maximum Redirects
Section titled “Maximum Redirects”Use --max-redirs to change the redirect limit:
orb -L --max-redirs 5 https://example.comDefault: 10 redirects
Redirect Examples
Section titled “Redirect Examples”# Follow redirects (common pattern)orb -L https://short.url/abc
# See redirect chain with verboseorb -v -L https://httpbin.org/redirect/3
# Limit redirectsorb -L --max-redirs 2 https://example.comUnderstanding Redirects
Section titled “Understanding Redirects”Without -L, a redirect returns the 3xx response:
orb -i https://httpbin.org/redirect/1HTTP/1.1 302 Foundlocation: https://httpbin.org/getWith -L, the final response is returned:
orb -L -i https://httpbin.org/redirect/1HTTP/1.1 200 OKcontent-type: application/json...Redirect Types
Section titled “Redirect Types”Orb follows these redirect status codes:
- 301 Moved Permanently
- 302 Found
- 303 See Other
- 307 Temporary Redirect
- 308 Permanent Redirect
Redirect Loop Protection
Section titled “Redirect Loop Protection”Orb detects redirect loops and stops:
Error: Too many redirects (11). Maximum is 10. Use --max-redirs to increase.Combining Timeouts and Redirects
Section titled “Combining Timeouts and Redirects”# Follow redirects with timeoutsorb -L \ --connect-timeout 5 \ -m 30 \ --max-redirs 5 \ https://example.com
# Download with redirect followingorb -L -m 60 https://short.url/download -o file.zipCommon Patterns
Section titled “Common Patterns”API Health Check
Section titled “API Health Check”# Quick check with short timeoutsorb --connect-timeout 2 -m 5 -s https://api.example.com/health && echo "OK"Downloading Files (Often Redirected)
Section titled “Downloading Files (Often Redirected)”# GitHub releases redirect to CDNorb -L -o release.tar.gz \ https://github.com/user/repo/releases/latest/download/release.tar.gzURL Shortener Resolution
Section titled “URL Shortener Resolution”# See where a short URL goes (without following)orb -I https://bit.ly/example
# Follow to final destinationorb -L -I https://bit.ly/example