How to Trace HTTP URL Redirection Chains Using Command Line Tools for Legal Documentation


4 views

When documenting URL redirections for legal purposes, we need a verifiable command-line method that produces timestamped evidence. Here's a comprehensive approach using standard tools available in Windows:

curl -v -L http://example.com/old-url 2>&1 | tee redirection_log.txt

This command will:

  • -v: Show verbose output including HTTP headers
  • -L: Follow redirects automatically
  • 2>&1: Combine stderr and stdout
  • tee: Save output to file while displaying it
[System.Net.HttpWebRequest] $request = [System.Net.WebRequest]::Create("http://example.com/old-url")
$request.AllowAutoRedirect = $false
$response = $request.GetResponse()
$response.StatusCode
$response.Headers["Location"]
telnet example.com 80
GET /old-url HTTP/1.1
Host: example.com

This manual approach shows raw HTTP responses including 301/302 status codes and Location headers.

For legal documentation, include:

  • Full command with timestamp
  • Complete output including headers
  • Network conditions (public/private IP)
  • Verification of SSL certificates when present
=====================================
URL Redirection Trace Report
Date: 2023-11-15 14:30 UTC
Tool: curl 7.83.1
Command: curl -v -L http://ex.com/old 2>&1
=====================================
* Connected to ex.com (192.0.2.1) port 80
> GET /old HTTP/1.1
> Host: ex.com
> 
< HTTP/1.1 301 Moved Permanently
< Location: https://ex.com/new
< 
* Connection #0 left intact
* Connecting to ex.com (192.0.2.1) port 443
> GET /new HTTP/2
> Host: ex.com
> 
< HTTP/2 200 

For complex redirect chains:

curl -v -L --max-redirs 10 --post301 --post302 --post303 http://start.url 2>&1

Parameters control redirect behavior and prevent infinite loops while documenting each hop.


When documenting URL redirections for legal purposes, we need to generate immutable evidence that clearly shows:

  1. The initial HTTP request
  2. The server's redirect response (status code 3xx)
  3. The final destination URL

For Windows systems, these command line tools provide the most reliable way to document redirections:

curl -v http://example.com/oldurl > redirect_log.txt

Example output that would be valuable for legal documentation:

> GET /oldurl HTTP/1.1
> Host: example.com
> 
< HTTP/1.1 301 Moved Permanently
< Location: https://example.com/newurl

PowerShell provides more detailed control and output formatting:

Invoke-WebRequest -Uri "http://example.com/oldurl" -MaximumRedirection 0 -UseBasicParsing | Select-Object StatusCode, Headers, RawContent | Out-File -FilePath .\redirect_evidence.txt

For complex cases with multiple hops:

curl -L -v http://example.com/starturl 2>&1 | tee full_redirect_chain.log

To create legally valid documentation:
1. Run commands in clean CMD/PowerShell session
2. Pipe output to timestamped log files
3. Include system information:

systeminfo > system_information.txt

4. Create MD5 checksums of output files:

certutil -hashfile redirect_evidence.txt MD5

For web developers needing more detailed analysis:

# Using HTTPie (modern curl alternative)
http --follow --headers --verbose example.com/oldurl

# Using WFetch (GUI tool that generates logs)

When collecting this evidence:
- Document exact date/time of tests
- Note network conditions
- Capture full HTTP headers (including cookies if relevant)
- Store raw output without modifications