1

I have a file hosted on amazon s3 service http://www.example.com/tempfile.html

Now if I pass a parameter with url like http://www.example.com/tempfile.html?u=2345

Will this be treated as a different url altogether and I will get no benefit of caching?

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125

1 Answers1

0

Will this be treated as a different url altogether and I will get no benefit of caching?

Generally speaking, adding the Query string yields a different URL indeed, which in itself is still fully cacheable accordingly, see section Side Effects of GET and HEAD (within Caching in HTTP):

We note one exception to this rule: since some applications have traditionally used GETs and HEADs with query URLs (those containing a "?" in the rel_path part) to perform operations with significant side effects, caches MUST NOT treat responses to such URIs as fresh unless the server provides an explicit expiration time.

This is actually a widely used, though somewhat controversial technique to enforce browsers to replace long living static assets like CSS/JS, see e.g. SCdF's answer to What is an elegant way to force browsers to reload cached CSS/JS files? and its comments for an extensive discussion of this and related approaches and the respective pros and cons. The apparently preferred solution for the CSS/JS topic nowadays uses filename fingerprinting rather than adding a query fragment accordingly, as discussed in the accepted and other answers there as well.

Community
  • 1
  • 1
Steffen Opel
  • 63,899
  • 11
  • 192
  • 211