URL Components
URL components for resource addressing, routing, caching, and security rules.
A URL is the structured address that tells a client how to locate a resource. Most people recognise one when they see it, but understanding the components is useful because routing, security policy, caching, and application behaviour often depend on specific parts of the URL rather than the string as a whole.
The first component is the scheme, sometimes called the protocol, such as http, https, ftp, or mailto. The scheme tells the client which set of rules to use when interpreting the rest of the address. In web applications, the difference between http and https is especially important because it affects transport security, mixed-content rules, and how browsers define origin boundaries.
Next comes the authority section. For web URLs this usually includes an optional user info component, the host name, and an optional port. The host identifies the domain or IP address to contact. The port selects a specific service on that host if it differs from the default for the scheme. For example, HTTPS usually implies port 443 if no explicit port is given.
After the authority comes the path. The path identifies a resource or route within the server namespace. On a static site it might map fairly directly to files. In a modern web application it often maps to application routing logic instead. A path is not just decoration. Reverse proxies, caches, and authorisation middleware may all treat different paths differently.
The query string begins with a question mark and carries key-value pairs such as page numbers, filters, search terms, or tracking parameters. Servers usually parse these parameters to influence the response. Query parameters are flexible, but that flexibility creates risk: unvalidated parameters can change database queries, expose sensitive state, or produce cache fragmentation if they are used carelessly.
The fragment appears after a hash character. It is usually handled on the client side to point to a section within a document or a route state inside a single-page application. Browsers do not send the fragment to the server in ordinary HTTP requests, which is why it is often used for in-page navigation rather than server-side logic.
URLs also depend on encoding rules. Spaces, non-ASCII characters, and reserved delimiters must often be percent-encoded so the parser can distinguish data from structure. Poor handling of encoding is a common source of broken links, signature mismatches, and subtle security bugs.
One more concept matters in web security: origin. For browsers, origin is the combination of scheme, host, and port. A change in any one of those creates a different origin, which affects cookies, CORS, and same-origin protections.
So a URL is not just a web address in casual language. It is a structured contract between client and server. If you can identify the scheme, authority, path, query, fragment, and encoding constraints, you can reason much more clearly about routing, caching, debugging, and security behaviour across the web stack.