How does HTTP 1.1 server should respond to a HTTP 1.0 request for headers like Pragma : no-cache
which are supported in HTTP 1.0 but not in HTTP 1.1
If we assume that the HTTP 1.1 server wants to be backward compatible with HTTP 1.0 clients, then the HTTP 1.1 server would send a HTTP 1.0 response to HTTP 1.0 clients.
For example, let's assume that your HTTP 1.0 client sends a request like this:
GET /path/to/resource HTTP/1.0
Notice that the last part of the request is "HTTP/1.0", indicating the client's supported HTTP version. We'll get back to this, but it's important.
Your HTTP 1.1 server might normally want to use the Cache-Control
response header to disable any caching, e.g.:
HTTP/1.1 200 OK
Cache-Control: no-cache
But Cache-Control
is not supported for HTTP 1.0 requests, and the above response indicates that it is an HTTP 1.1 response, which is odd, given the HTTP 1.0 request.
So instead, the HTTP 1.1 server would have to generate an HTTP 1.0 compliant response, like so:
HTTP/1.0 200 OK
Pragma: no-cache
The HTTP 1.1 server ideally pays attention to the HTTP version in the request, and constructs a response that is appropriate for that HTTP version. For an older client (.e.g. HTTP 1.0) communicating with a newer, backward-compatible server (e.g. HTTP 1.1), this works.
What happens, though, if it's a newer client talking to an older server, such as an HTTP 1.1 client talking to an HTTP 1.0 server? In that case, the request might be:
GET /path/to/resource HTTP/1.1
Host: example.com
Cache-Control: no-cache
The HTTP 1.0 server won't know about the Cache-Control
header, or any other HTTP 1.1-isms. In this case, the HTTP 1.0 server might reject the response using "400 Bad Request" (or some other similar non-success response code) because of the version incompatibility, or the server might issue an HTTP 1.0 response to the HTTP 1.1 request:
HTTP/1.0 200 OK
Pragma: no-cache
The actual behavior you see will depend on the client and server implementations involved.
Hope this helps!