URL Parser & UTM Query Inspector
Deconstruct URLs into protocol, host, port, path, anchor hash, and inspect all query string parameters with UTM tracking detection.
Unlike conventional calculator sites that send your financial numbers, payload data, or code snippets across remote web servers, Affi-Chain processes all mathematical derivations, algorithms, and data parsing 100% locally within your browser sandbox. No tracking cookies, no server-side retention, and zero transmission lag.
What is a URL Parser?
A URL Parser is an essential networking and web development utility that decomposes a raw Uniform Resource Locator (URL) into its standardized constituent components, such as the protocol scheme, domain hostname, port number, hierarchical path, URL-encoded query parameters, and fragment identifier.
Standardized under IETF RFC 3986 and the modern WHATWG URL Living Standard, URLs serve as the foundational addressing system of the World Wide Web. Whether constructing backend microservices routing tables, analyzing incoming webhook targets, validating OAuth 2.0 redirect URIs, or extracting marketing UTM attribution parameters in frontend analytics pipelines, correctly parsing and validating URLs is critical to building reliable, secure applications.
The Affi-Chain URL Parser executes instant, client-side URI deconstruction directly within your browser memory. It validates structural syntax, decodes percent-encoded components, exposes nested query strings via an interactive key-value inspector, and flags potential security anomalies in sub-millisecond time.
The 9 Anatomical Components of a URI (RFC 3986)
A fully qualified URL adheres to the following structural grammar:
$$\underbrace{\text{https}}{\text{Scheme}}\text{://}\underbrace{\text{user:pass}}{\text{Userinfo}}\text{@}\underbrace{\text{api.example.com}}{\text{Host}}\text{:}\underbrace{\text{443}}{\text{Port}}\underbrace{\text{/v2/orders}}{\text{Path}}\underbrace{\text{?status=shipped&sort=desc}}{\text{Query}}\underbrace{\text{#summary}}_{\text{Hash}}$$
| Component | Example Value | Definition & Purpose |
|---|---|---|
protocol / scheme | https: | Defines the access protocol (https:, http:, ftp:, mailto:, ws:, wss:). |
username | alice | Authentication identity for basic auth over HTTP. |
password | secret123 | Password associated with the basic auth user. |
host | api.example.com:443 | The full host string, including the port if non-default. |
hostname | api.example.com | The domain name (FQDN) or IP address without port information. |
port | 443 | The destination networking TCP/UDP port number. |
pathname | /v2/orders | Hierarchical resource path on the target server. |
search / query | ?status=shipped&sort=desc | Key-value query parameters preceded by a ?. |
hash / fragment | #summary | Client-side anchor identifier preceded by a # (never sent to the server). |
origin | https://api.example.com:443 | The combined tuple of protocol + '//' + hostname + (':' + port). Used by browsers for CORS security. |
Step-by-Step Real-World Breakdown Example
Consider a complex marketing campaign URL with deep tracking and redirect instructions:
Raw Input URL:
https://analytics.affichain.com:8443/track/events?campaign_id=nov_2026&source=devto&utm_medium=article#conversion-stats
Parsed Component Architecture:
- Protocol / Scheme:
https: - Hostname:
analytics.affichain.com - Port:
8443(Custom non-standard TLS port) - Origin:
https://analytics.affichain.com:8443 - Pathname:
/track/events - Search / Query String:
?campaign_id=nov_2026&source=devto&utm_medium=articlecampaign_id→nov_2026source→devtoutm_medium→article
- Fragment / Hash:
#conversion-stats
Modern JavaScript & TypeScript Implementation Snippet
In modern frontend and Node.js runtimes, developers should strictly avoid brittle regex string splitting and use the native WHATWG URL and URLSearchParams APIs:
function parseAndInspectUrl(rawUrl: string) {
try {
const parsed = new URL(rawUrl);
// Extract core components
console.log("Protocol:", parsed.protocol); // "https:"
console.log("Hostname:", parsed.hostname); // "analytics.affichain.com"
console.log("Pathname:", parsed.pathname); // "/track/events"
console.log("Origin:", parsed.origin); // "https://analytics.affichain.com:8443"
// Iterate through query parameters effortlessly
const queryParams: Record<string, string> = {};
parsed.searchParams.forEach((value, key) => {
queryParams[key] = value;
});
console.log("Extracted Query Params:", queryParams);
return {
isValid: true,
origin: parsed.origin,
params: queryParams
};
} catch (error) {
console.error("Invalid URL format:", (error as Error).message);
return { isValid: false, error: (error as Error).message };
}
}
Technical Comparison: WHATWG URL vs Legacy Node url.parse() vs RegEx
| Approach | Standards Compliance | Security & Sanitization | Complex Query Support | Deprecation Status |
|---|---|---|---|---|
WHATWG URL Standard (Affi-Chain Engine) | Strict 100% WHATWG Living Standard. Matches all modern browser engines. | Immune to hostname spoofing and null-byte injection attacks. | First-class URLSearchParams object with multi-value support. | Active Modern Standard. |
Legacy Node.js url.parse() | Incomplete legacy RFC 2396 compliance. | Vulnerable to host/port confusion vulnerabilities (CVE-2021-22959). | Primitive dictionary mapping; fails on duplicated array keys. | Deprecated since Node.js v11; emits warnings. |
| Custom Regular Expressions | Ad-hoc and incomplete; fails on IPv6 addresses and international domain names (IDN). | Extremely fragile; frequently bypassed in security filters. | Requires secondary custom tokenization routines. | High maintenance risk; anti-pattern in production. |
Critical Edge Cases & Common Security Vulnerabilities
When processing URLs supplied by external users or untrusted API payloads, developers must defend against several critical security exploits:
1. Server-Side Request Forgery (SSRF) via Localhost & Cloud Metadata
- The Vulnerability: If your backend microservice accepts a URL from an HTTP request and fetches it (e.g. generating an unfurl preview), an attacker might provide:
http://127.0.0.1:6379(Directly commands local Redis database).http://169.254.169.254/latest/meta-data/(Exposes AWS IAM cloud credentials).
- The Defense: Always resolve the parsed
hostnamevia DNS and explicitly verify that the destination IP address does not fall within private IPv4 (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.0/8) or link-local ranges before issuing network requests.
2. The Open Redirect Exploit via Double-Slash Traps
- In OAuth flows, authentication servers often accept a
redirect_uriparameter. - The Attack: An attacker passes
redirect_uri=//evil.com/login. - A naive parser checking
if (redirect_uri.startsWith("/"))will assume this is a relative path on your website! However, modern web browsers interpret//evil.comas a protocol-relative URL, immediately redirecting the victim to an external phishing site with their authentication token! - The Fix: Always parse the target URL with
new URL(redirect_uri, window.location.origin)and verifyparsed.origin === expectedOrigin.
3. Percent-Encoding Quirks (%20 vs +)
- In the path section of a URL, a space character must be encoded strictly as
%20. - In the query string (
application/x-www-form-urlencoded), spaces are historically permitted to be encoded as a plus sign (+). - When parsing query parameters, always use
decodeURIComponent(val.replace(/\+/g, ' '))or nativeURLSearchParams.get()to prevent corrupted strings.
4. IPv6 Literal Addressing
- Unlike standard IPv4 addresses (
192.168.1.1:8080), IPv6 addresses contain multiple colons (fe80::1ff:fe23:4567:890a). - To prevent ambiguous confusion with the port delimiter colon, RFC 3986 requires IPv6 hostnames to be enclosed strictly in square brackets:
http://[2001:db8::1]:8080/api - Our parser natively detects and extracts IPv6 literals without splitting on internal hex colons.