Start here. This is the direct spoken answer to practice first.
Why this question matters
Fetching a user URL turns the API into a network client with access the caller may not have. Simple string validation misses redirects, alternative address forms, DNS changes, and cloud metadata or internal services.
The safest design avoids arbitrary destinations. When the business knows the integrations, I use an allowlist of exact schemes, hosts, and ports, parse with a trusted URI parser, resolve the destination, and reject loopback, link-local, private, multicast, and other forbidden ranges for both IPv4 and IPv6. I disable or revalidate redirects, permit only HTTP or HTTPS as required, and never copy inbound credentials to the outbound request. Time, response-size, and content-type limits prevent the fetch from becoming a resource attack.