Shared server guidance · Question & answer

How do I inspect an HTTP redirect chain from PowerShell?

Use curl.exe to inspect each response in a redirect chain without relying on a browser’s cached navigation. The .exe suffix selects the curl executable rather than a PowerShell alias. A useful check records both the original HTTP response and the final HTTPS destination.

BeginnerWindows with the curl executable available in PowerShell
Go to the answer

Before you start

  • The exact public URL being diagnosed.
  • A request that is safe to repeat without credentials.

Instructions

1. Inspect the first response

Start without following redirects so the first Location header is visible. Use the actual hostname; an IP address can select a different virtual host.

Local Windows PowerShell
curl.exe --head --connect-timeout 5 --max-time 15 http://app.example.com/

Requests response headers for the initial HTTP URL.

2. Follow a bounded chain

Read each status and Location in order. The redirect limit prevents an endless loop, and allowed redirect protocols are restricted to HTTP and HTTPS.

Local Windows PowerShell
curl.exe --head --location --max-redirs 5 --proto-redir "=http,https" --connect-timeout 5 --max-time 20 http://app.example.com/

Follows up to five redirects while preserving normal certificate verification for HTTPS.

3. Check the canonical destination

The final hostname and path should be intentional. Repeated switching between www and non-www, HTTP and HTTPS, or two login URLs often indicates conflicting application and proxy settings.

Check the result

  • The chain ends at the expected HTTPS URL with a suitable final response and no redirect loop.

Troubleshooting

HEAD returns 405 although the site loads
The application may reject HEAD. Use a safe GET with --output NUL and --dump-header - to inspect headers without displaying the body.
The certificate check fails after a redirect
Validate the redirected hostname and certificate instead of bypassing TLS verification.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.