URL Parsing, Redirects, DNS, and Headless Browsers
Follow a URL through redirects, DNS lookups, connections, and browser resources so approval stays attached to the actual destination.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
A link-preview worker approves a public URL. The public page replies with a redirect to a private address, and the HTTP client follows it. The first URL passed a check; the later connection did not.
Approved public URL → redirect response → a new destination → a new permission decision
We'll follow the actual destination through that journey. Then we'll examine a hostname resolved twice, multiple address answers, and the additional requests made by a headless browser. The rule is the same throughout: the connection must use a destination the policy approved.
Begin with the feature's real destination policy
Some services only need to call a small set of known partner endpoints. Others intentionally fetch arbitrary public websites. These are different policies. A fixed partner feature can often accept a partner identifier and construct an application-owned URL. A public link preview needs a broader destination model, stronger isolation, and limits on network behavior.
Write down the permitted schemes, ports, destinations, redirects, credentials, and response types before reviewing a validator. Do not start by collecting strings associated with past SSRF demonstrations. A denylist containing localhost and one loopback address does not define all the addresses, protocols, or resolution paths the application can reach.
Feature: public link preview
Caller: signed-in workspace member
Permitted protocols: HTTP and HTTPS for this training design
Permitted destination class: approved public internet addresses
Disallowed destination class: internal, loopback, link-local, and other non-public targets
Redirect policy: bounded hops, every destination re-evaluated
Credentials: no application session cookies or internal authorization headers
Response budget: bounded time, headers, compressed and decoded body size
Execution: no page JavaScript in the simple document-fetch variant
This policy is still a design brief. An actual deployment must choose how it identifies public addresses, whether it permits arbitrary ports, what networks its workers can reach, and which outbound proxy or transport enforces the rule. A cloud provider's metadata protections and workload identity permissions add important context but do not substitute for that destination boundary.
If the feature only needs a user's avatar from a known asset provider, accepting a full arbitrary URL may be unnecessary. Reducing the available input language can remove whole categories of parsing and redirect ambiguity. That is a product decision to evaluate, not a reason to pretend every URL-based feature can use a two-host allowlist.