Why browsers cache data, don't send request to server, only if query parameters in url are in same order?
For example if request to
/product?q=phone&cat=1
send in response header Cache-Control:max-age=60
the next request
/product?cat=1&q=phone
request is send to server, but should retrieve data from cache
Also some frameworks recommend
If you are caching requests that use a large number of query string parameters, consider sorting them to ensure that the request is properly cached.
By ordering your params, you can be sure the cache key will be consistent across requests and you are caching effectively.
HTTP doesn't define the syntax of query parameters. So from the cache's point of view, these URLs might identify different content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With