A link that looks familiar can pass through several servers before reaching its final destination. Some redirects are routine, but a chain can also obscure a destination, downgrade a connection, or send a visitor somewhere unexpected. Investigating it carelessly can expose your browser or network to risk.
This guide explains how to inspect redirect responses without opening an unknown destination, interpret common HTTP status codes, and validate each destination. The examples use fictional domains or a local server you control.
Key takeaways
- A redirect response usually includes a 3xx status code and a
Locationheader identifying the next URL. - Record each hop separately; do not assume the first or final URL tells the whole story.
- Inspect unknown links as data before considering any network request. Do not open a suspicious destination just to see where it goes.
- Validate the scheme, hostname, port, and every subsequent destination. For server-side URL fetching, a parser or hostname check alone is not an SSRF defense.
- Use network inspection only on systems you own or have permission to test.
What a redirect chain reveals
A redirect chain is a sequence of HTTP responses that sends a client from one URL to another. For example, a link might point to https://start.example.test/article, which responds with a redirect to https://portal.example.test/page, which then redirects to a final page.
Each transition is a separate hop. A useful record includes:
| Hop | Requested URL | Status | Location destination | Notes |
|---|---|---|---|---|
| 1 | https://start.example.test/article | 302 | https://portal.example.test/page | Host changes |
| 2 | https://portal.example.test/page | 301 | https://final.example.test/ | Permanent redirect response |
| 3 | https://final.example.test/ | 200 | — | Example final response |
These values are fictional and illustrate how to document a chain; they are not a live destination. A redirect may be expected—for example, a site may send HTTP traffic to HTTPS—or unexpected, such as a change to an unrelated hostname. Context matters: a 3xx response alone does not prove that a link is malicious.
Understand the HTTP status codes
The Location response header commonly supplies the next URL for a redirect. The status code describes the redirect’s behavior, including how a client may handle the request method:
- 301 Moved Permanently and 302 Found indicate redirects. Under HTTP semantics, clients may change a
POSTto aGETin some cases; behavior for ordinary browser navigation is typically less noticeable because navigation commonly usesGET. - 303 See Other directs the client to retrieve another resource, generally with
GETorHEAD. - 307 Temporary Redirect and 308 Permanent Redirect preserve the request method when following the redirect.
- 304 Not Modified is a cache-related response, not a redirect to another URL. It should not be treated as another hop in a redirect chain.
A client can impose its own redirect limit, and different clients or request methods can produce different results. A chain observed with a command-line client may not match every browser experience. Treat status codes as evidence to interpret, not as a verdict about safety.
How to investigate a suspicious redirect chain safely
1. Preserve the link without opening it
Copy the URL as text, if you can do so without activating it. Avoid clicking, pasting it into a browser address bar, or using a preview that automatically visits the destination. If the URL contains account tokens, private query parameters, or other sensitive data, do not submit it to a public analysis service.
For an initial, non-networking review, inspect the URL’s parts with a trusted parser. A URL parser can help distinguish the scheme, hostname, port, path, and query string, but it cannot establish that a destination is safe. For a chain-focused workflow, you can also visit the redirect checker; avoid submitting sensitive URLs, and remember that any service that checks a URL may make network requests.
2. Inspect the starting URL
Check the following before deciding whether any request is appropriate:
- Scheme: Is it
httpsorhttp? An HTTPS starting URL does not guarantee that every hop stays on HTTPS. - Hostname: Read the actual host, not just a familiar word somewhere in the URL. In
https://trusted.example@other.example.test/, the hostname isother.example.test; the text before@is user information. - Lookalikes: Watch for misspellings, unexpected subdomains, internationalized domain names, and hostnames that merely begin with a familiar brand name. For example,
trusted.example.test.attacker.testis not a subdomain ofexample.test. - Port and address form: Note unusual ports and IP-literal hosts. Their presence is not conclusive by itself, but it may need explanation.
- Path and query: Paths and parameters can reveal where a redirect is intended to go, but encoded or application-specific values may not be obvious from a quick glance.
3. Examine one redirect response at a time
If you are authorized to investigate the site and the request is appropriate for your environment, inspect the response without automatically following redirects. For example, on a local test server you control:
curl --silent --show-error --dump-header - --output /dev/null --max-redirs 0 http://127.0.0.1:8000/start
This command requests only the local test endpoint and prints response headers. It does not use curl’s --location option, which would follow redirects. A fictional response might look like this:
HTTP/1.1 302 Found
Location: https://portal.example.test/page
Cache-Control: no-store
Record the status and Location value, then assess the next hop before making any further request. Do not replace the local example with an unknown or unauthorized destination just to reproduce the chain. Even a request that does not follow redirects still contacts its first host and can disclose network metadata or trigger server-side behavior.
4. Validate every destination
For each Location value, determine whether it is an absolute URL or a relative reference, then resolve it in the context of the current URL. Check the resulting scheme, hostname, port, and path. A relative destination such as /login stays on the current origin; an absolute destination may switch hosts or schemes.
Look for changes that need explanation, including an HTTPS-to-HTTP downgrade, an unexpected hostname, a nonstandard port, or a destination outside an organization’s expected domain. Compare hostnames as complete names: a string-prefix check is not sufficient to establish that one host belongs to another. Internationalized names can also be displayed in different forms, so use a reputable URL-handling library when implementing comparisons.
5. Keep browser protections in perspective
Browsers apply security rules to web content, but those rules do not make every navigation safe. The same-origin policy primarily restricts how scripts access data across origins; it does not mean that a user cannot be navigated to another origin. CORS is not a general-purpose warning system for suspicious links. Do not rely on either mechanism as a substitute for checking a destination.
If you are building a server-side redirect checker
A service that fetches user-supplied URLs has a different risk profile from a person reviewing URL text. It may be exposed to server-side request forgery (SSRF), in which a request is induced to reach resources the service should not access. A URL parser or hostname allowlist by itself is not a complete defense.
A safer design should, at minimum:
- Allow only the schemes the product needs, usually
httpandhttps, and reject unexpected URL forms. - Apply a strict destination policy, preferably an explicit hostname allowlist where the use case permits it.
- Resolve and validate destination addresses, blocking loopback, private, link-local, and other prohibited ranges as appropriate to the environment.
- Revalidate every redirect target. Do not assume that a safe first host will send the client to a safe next host.
- Account for DNS changes and rebinding between validation and connection. Enforce network-level egress restrictions as an additional boundary.
- Set limits on redirects, response size, time, and supported protocols; avoid forwarding sensitive cookies, authorization headers, or internal credentials.
- Log enough to investigate decisions without unnecessarily retaining sensitive query strings or user data.
The right controls depend on the service’s purpose, network, and HTTP client. Treat these points as a design checklist, not a complete implementation or a guarantee against SSRF.
Common mistakes
- Opening the link to see what happens: This can expose the browser to unwanted downloads, tracking, or unsafe content. Start with text and response metadata instead.
- Trusting the first hostname: A chain can leave that host on the next hop. Validate every destination.
- Assuming HTTPS means trustworthy: HTTPS protects a connection to a host; it does not establish that the host or page is benign.
- Using loose hostname matching: Checks such as “starts with
trusted.example” can accept unrelated names. Compare parsed hostnames using a carefully defined policy. - Treating every 3xx response alike: Redirect status codes have different method semantics, and 304 is not a redirect destination.
- Following redirects automatically during server validation: Automatic following can skip the chance to inspect and validate each destination.
- Assuming a URL tool is a security boundary: Parsing or displaying a URL can aid review, but it cannot prevent unsafe browser navigation or secure a server-side fetch by itself.
Defensive recommendations
For users and site administrators, preserve suspicious links as text, document each observed hop, and compare destinations with an independently known official domain. Report unexpected redirects to the site owner or security team through a trusted channel. Do not investigate infrastructure you do not own or have explicit authorization to test.
For developers, keep redirect destinations constrained where possible, validate the final destination on the server, and avoid open redirects that accept arbitrary external URLs. If your application must fetch URLs, apply SSRF defenses at both the application and network layers.
Conclusion
A safe redirect investigation is deliberate: inspect the starting URL, collect one response at a time when authorized, and validate every destination before proceeding. Status codes and headers help explain what a client is being asked to do, but they cannot prove that a destination is trustworthy. When in doubt, do not open the link; preserve the evidence and ask an authorized security contact to review it.
References
- RFC 9110, HTTP Semantics: https://www.rfc-editor.org/rfc/rfc9110.html
- MDN Web Docs, Redirections in HTTP: https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
- MDN Web Docs, Same-origin policy: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
