Query Parameters
Configure cleanup of query parameters to improve performance and reduce the number of requests to the origin
Query parameters
Query parameters in URLs can significantly impact caching efficiency and site performance. Since different query parameter strings represent different objects in the CDN's cache, there is always a risk that query parameters unnecessary create multiple cache entries for the same content, reducing cache hit rates and increasing load on your origin server.
For example, ads plaforms can add a query parameter when someone presses a link, making each ad generated request unique.
The query parameter setting can be used to instruct the CDN to remove or filter query parameters before continuing, which will increase hit ratio, performance while reducing the load or origin servers.
Remove query parameters
The Redirect and Continue options both remove all query parameters from the URL, keeping only the path component:
- Redirect: Removes query parameters and redirects the client to the clean URL (HTTP 307 redirect)
- Continue: Removes query parameters silently without redirecting the client
When query parameters are removed, the CDN keeps only the path portion of the URL, discarding everything after the ? character.
For the Redirect option, the redirect preserves the protocol (HTTP/HTTPS) based on the original request. If the original request was over TLS, or if an HTTPS redirect was scheduled, the redirect will be to the HTTPS version of the URL.
Use Redirect when you want clients to see and potentially bookmark the clean URL. Use Continue when you want to handle the cleanup transparently.
Sort query parameters
The Sort option normalizes query parameters by sorting them alphabetically. This ensures that URLs with the same parameters in different orders are treated as the same cache entry:
example.com/page?b=2&a=1&c=3 → example.com/page?a=1&b=2&c=3
The CDN will reorder the query parameters alphabetically by parameter name, ensuring consistent cache keys regardless of the order parameters appear in the original URL. This is particularly useful for APIs or applications where query parameter order varies but the semantic meaning remains the same.
No query parameter processing
The Off option disables any query parameter processing. The URL will be passed through unchanged to both cache lookups and origin requests.
Best practices
For optimal caching performance, it is recommended to remove query parameters whenever possible using the Continue or Redirect options. This maximizes cache hit rates and reduces unnecessary load on your origin servers.
Use rule overrides to allow query parameters to pass through only for specific paths where they are actually required for application functionality, such as search endpoints, API calls with filter parameters, or dynamic content generation.
When query parameters cannot be removed, use the Sort option rather than Off. Sorting ensures that URLs with the same parameters in different orders are treated as a single cache entry, significantly improving cache efficiency. Only use Off if your origin server specifically relies on query parameter order, which should not be the case for normal web servers following standard HTTP practices.