rav
rav

Reputation: 247

Sending an "if-modified-since" header in the request

I am new to working with the Rest API in Java. I am trying to implement if-modified-since request and got stuck with questions:

  1. Client sends a get request and the server responds with a resource and a Last-Modified header. From then on, client sends a request with the Last-Modified in the if-modified-since header. Does this mean that, the first get request from client does not have a if-modified-since header ?
  2. Would the Last-Modified received in the response stored in the browser for ever or should it be stored some where in the client side database to make further requests?

Upvotes: 0

Views: 1887

Answers (1)

john_omalley
john_omalley

Reputation: 1398

  1. No, there won't be an if-modified-since if the client does not have a cached version of the resource.

  2. This is up to the client. Browsers certainly don't cache everything indefinitely. But in theory an arbitrary client could store the last modified timestamp wherever it needs to.

Upvotes: 1

Related Questions