Skip to content

Timeouts & Redirects

Use --connect-timeout to set the maximum time for establishing a connection:

Terminal window
orb --connect-timeout 5 https://example.com

Default: 10 seconds

This timeout covers:

  • DNS resolution
  • TCP connection establishment
  • TLS handshake

Use -m or --max-time to set the maximum total request time:

Terminal window
orb -m 30 https://example.com

This timeout covers the entire request, from start to finish, including:

  • Connection establishment
  • Sending the request
  • Receiving the response
Terminal window
# Quick health check - fail fast
orb --connect-timeout 2 -m 5 https://api.example.com/health
# Allow time for large download
orb -m 300 https://example.com/large-file.zip -o file.zip
# Slow server, generous timeouts
orb --connect-timeout 30 -m 120 https://slow-server.example.com

By default, orb does not follow HTTP redirects (3xx responses).

Use -L or --location to follow redirects:

Terminal window
orb -L https://httpbin.org/redirect/3

This will follow up to 10 redirects by default.

Use --max-redirs to change the redirect limit:

Terminal window
orb -L --max-redirs 5 https://example.com

Default: 10 redirects

Terminal window
# Follow redirects (common pattern)
orb -L https://short.url/abc
# See redirect chain with verbose
orb -v -L https://httpbin.org/redirect/3
# Limit redirects
orb -L --max-redirs 2 https://example.com

Without -L, a redirect returns the 3xx response:

Terminal window
orb -i https://httpbin.org/redirect/1
HTTP/1.1 302 Found
location: https://httpbin.org/get

With -L, the final response is returned:

Terminal window
orb -L -i https://httpbin.org/redirect/1
HTTP/1.1 200 OK
content-type: application/json
...

Orb follows these redirect status codes:

  • 301 Moved Permanently
  • 302 Found
  • 303 See Other
  • 307 Temporary Redirect
  • 308 Permanent Redirect

Orb detects redirect loops and stops:

Error: Too many redirects (11). Maximum is 10. Use --max-redirs to increase.
Terminal window
# Follow redirects with timeouts
orb -L \
--connect-timeout 5 \
-m 30 \
--max-redirs 5 \
https://example.com
# Download with redirect following
orb -L -m 60 https://short.url/download -o file.zip
Terminal window
# Quick check with short timeouts
orb --connect-timeout 2 -m 5 -s https://api.example.com/health && echo "OK"
Terminal window
# GitHub releases redirect to CDN
orb -L -o release.tar.gz \
https://github.com/user/repo/releases/latest/download/release.tar.gz
Terminal window
# See where a short URL goes (without following)
orb -I https://bit.ly/example
# Follow to final destination
orb -L -I https://bit.ly/example