One thing worthy of at least some partial consideration is the impact
of using HTTP headers for differing the body of the response.
Unfortunately I do not myself hold enough knowledge of my own to
follow this enquiry up, so I'm hoping others can assist.
My understanding is that if a transparent cache between client and
server does not have specific knowledge of the custom headers being
used, it may be unaware that these have any impact on the response
returned and therefore return an incorrect cached response?
For examples Client A and Client B are both communicating with Service
Provider via the same transparent cache. Service Provider will return
a narrower subset of stations (for example, 3 services) in the XSI if
you specify params via the X-Bearer header, instead of a standard
request where all known services (for example, 15 services) are
listed.
Client A makes a request for /XSI.xml with an X-Bearer header and gets
3 services returned in the response. The transparent cache holds the
response keyed against the resource requested /XSI.xml. Client B makes
a request without an X-Bearer header. The transparent cache spots the
same resource request and immediately returns the previously cached
document with only 3 services.
Realistically if this is a genuine problem, I would have thought this
would break many other things beyond our own focus, for example OAuth
prefers header-based auth negotiation. I would assume, therefore, that
most caches take headers in to consideration - but I have little
experience of how production systems deal with this. Do they have a
whitelist of headers to be considered of which we'd need to be
included? Is it of little concern?
Andy.
HTTP caching is not available for POST requests or GET requests with
query strings, due to their typical implementation for entirely
dynamic responses based on their input. As our intention lies
somewhere between dynamic and static it is preferred to find a method
that works with traditional HTTP caching, but allows us to be somewhat
dynamic in our responses (which then leads back to my other post of
the suitability of custom HTTP headers).
I am unsure if this is still as big a concern today as it was - could
anyone clarify this situation?
"Don't include a query string in the URL for static resources. Most
proxies, most notably Squid up through version 3.0, do not cache
resources with a "?" in their URL even if a Cache-control: public
header is present in the response. To enable proxy caching for these
resources, remove query strings from references to static resources,
and instead encode the parameters into the file names themselves."
http://code.google.com/speed/page-speed/docs/caching.html#LeverageProxyCaching
Whilst our content isn't static, we are in a "psuedo-static" state -
we want it to be have like a static resource wherever possible. My
understanding of Google's statement is that you cannot reliably
guarantee content with a query string will be cached between client
and server or, worse still, incorrectly cached. The way to remove
doubt is to avoid the use of query strings.
On 27 March 2012 10:18, Andy Buckingham (RadioDNS)
HTTP/1.1 has a 'Vary' header which allows you to define any custom
headers that affected the returned response. This tells caches
downstream that the key used to store the content in the cache must
include the value for the defined headers.
Therefore, if we used X-Bearer, you would send a Vary header in the
response such as...
Vary: X-Bearer
It would be important to look at the HTTP version of the incoming
request too and if it's only HTTP/1.0 never vary the content upon the
header (return all known services). This way old caching layers
mid-stream wouldn't trip up by not understanding the vary header.
Useful discussion here for reference:
http://www.subbu.org/blog/2007/12/vary-header-for-restful-applications
On 27 March 2012 10:30, Andy Buckingham (RadioDNS)