
Security tool to trace URL's jumps across the rel links to obtain the last URL
Hoper shows every hop (redirect) a URL goes through until it reaches its final destination — useful for URL shorteners, tracking links in emails, SSO flows, or debugging redirect rules.
$ hoper http://github.com
Tracing http://github.com
1. → 301 Moved Permanently http://github.com/ 81ms
2. ✔ 200 OK https://github.com/ 50ms
1 redirect → https://github.com/
HEAD by default (no body downloads) with automatic fallback to GET for servers that reject it.HTTP_PROXY / HTTPS_PROXY / NO_PROXY and NO_COLOR.Requires Ruby 3.1 or newer.
gem install hoper
On Windows, install Ruby with RubyInstaller and then run the same command.
hoper [options] URL [URL...]
-m, --max-hops N Maximum redirects to follow (default: 20)
-t, --timeout SECONDS Timeout per request (default: 10)
-X, --method METHOD HTTP method: HEAD or GET (default: HEAD)
-A, --user-agent UA User-Agent header to send
-H, --header 'NAME: VALUE' Extra request header (repeatable)
-k, --insecure Do not verify TLS certificates
-j, --json Output results as JSON
--[no-]color Force/disable colored output
-v, --version Print version and exit
-h, --help Show this help
If the scheme is omitted, https:// is assumed (hoper example.com).
hoper --json http://github.com
{
"start_url": "http://github.com/",
"final_url": "https://github.com/",
"final_status": 200,
"redirects": 1,
"hops": [
{ "url": "http://github.com/", "status": 301, "reason": "Moved Permanently", "location": "https://github.com/", "duration_ms": 81 },
{ "url": "https://github.com/", "status": 200, "reason": "OK", "duration_ms": 50 }
]
}
With several URLs the output is an array.
| Code | Meaning |
|---|---|
| 0 | Every URL resolved to a non-error (< 400) final response |
| 1 | At least one URL failed (network error, loop, too many hops, 4xx/5xx) |
| 2 | Invalid usage / options |
require "hoper"
result = Hoper.trace("https://bit.ly/example", max_hops: 10)
result.hops.each { |hop| puts "#{hop.status} #{hop.url}" }
result.final_url # => "https://example.com/"
result.success? # => true
bundle install
bundle exec rake test
CI runs the test suite on Ubuntu, macOS and Windows (Ruby 4.0), plus the oldest supported Ruby (3.1) on Ubuntu. Tests use a local in-process HTTP server, so they don't need network access.
Releases are automated with GitHub Actions and RubyGems Trusted Publishing:
Bump lib/hoper/version.rb and add a section to CHANGELOG.md; merge to master.
Tag and push:
git tag v1.2.3 && git push origin v1.2.3
The Release workflow checks the tag matches the version, runs the tests, publishes the gem
to RubyGems.org and creates a GitHub Release with the CHANGELOG notes.
Bug reports and pull requests are welcome on GitHub at https://github.com/gabamnml/hoper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.