What are the parts of a URL (scheme, host, path, query string)?
Short answer
URL (Uniform Resource Locator) is the address of a resource and has the scheme://host:port/path?query#fragment format: scheme (http or https) shows the protocol, host the domain, port the port number (if it is not written, 80 in http and 443 in https), path the part that comes after the domain (/urun/detay), and query string the name=value parameters after ?; the fragment after # stays in the browser and is not sent to the server. In TR7, there is a separate condition for each part: URL evaluates the full address (including scheme and host), Path only the path, Path + Query the path together with the query, and Query Parameter a single parameter; the host part in the URL condition is taken from the Host header. The Set Path and Set Path + Query actions rewrite the address before it goes to the Backend Service, Location Redirection redirects the client to another address, and Ignore Query in the Cache profile removes the query string from the cache key.
Where It Is Used in TR7
| Where | Field / label | What for |
|---|---|---|
| Load Balancer → Conditions (Policy Match) → Criteria | URL, Path, Path + Query, Query Parameter | An action or Conditional Backend Services decision based on the different parts of the address |
| Load Balancer → Actions (Policy Actions) | Set Path, Set Path + Query | Rewriting the path (and the query) before it goes to the Backend Service |
| Load Balancer → Actions (Policy Actions) | Location Redirection, URL Normalization | Redirecting to another address; bringing the address to a single form |
| Load Balancer → Profiles (L4-L7 Behavior Sets) → Cache | Ignore Query (off by default), Ignore Host Header (off by default) | Removing the query string or the host from the cache key |
| Left Monitor Panel → WAF-Protected vServices → vService → WAF Management → N page types → rule | Path, Query tabs | The WAF checks applied to the path and the query parameters of the page |
Example
https://shop.example.com:443/urun/detay?id=42&renk=mavi#yorumlar
| Part | Value | Is it sent to the server |
|---|---|---|
| Scheme | https | As the connection type |
| Host | shop.example.com | In the Host header |
| Port | 443 | As the destination port of the connection |
| Path | /urun/detay | In the request line |
| Query string | id=42&renk=mavi | In the request line |
| Fragment | yorumlar | No |
Since the browser does not write the default port into the Host header, in this example the value the URL condition evaluates is https://shop.example.com/urun/detay?id=42&renk=mavi, that of the Path condition is /urun/detay, and that of the Path + Query condition is /urun/detay?id=42&renk=mavi. The general syntax of the URL is in RFC 3986.
Common Misconceptions
- "The Path condition also sees the query." Path evaluates only the path; for the query, Path + Query or Query parameter is used.
- "What comes after # also reaches the server." The fragment stays in the browser and is not added to the request; no condition in TR7 can see it.
- "The URL condition always sees the domain." In a request without a Host header, the URL condition uses the frontend IP:port value instead of the host.
How it is done in the documentation
Related questions
