Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1539

ServerCache should respect Vary headers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.1.0.Final
    • 3.0.19.Final
    • jaxrs
    • None

    Description

      The ServerCache enabled by the ServerCacheFeature does not respect the Vary header, which tells the headers that may modify the response for the same URI. E.g., this is a correct request/response exchange:

      GET /hello HTTP/1.1
      Accept: text/plain
      Accept-Language: en
      
      HTTP/1.1 200 OK
      Cache-Control: max-age=60
      Content-Type: text/plain
      Vary: Accept
      Vary: Accept-Language
      
      Hello!
      
      GET /hello HTTP/1.1
      Accept: text/plain
      Accept-Language: it
      
      HTTP/1.1 200 OK
      Cache-Control: max-age=60
      Content-Type: text/plain
      Vary: Accept
      Vary: Accept-Language
      
      Ciao!
      

      With the ServerCacheFeature, the last response would contain Hello! (i.e. cached from the previous request), instead of Ciao!.
      When caching responses, the ServerCache should use all Vary headers in it and use them to match possible cached results.

      Attachments

        Activity

          People

            rsigal@redhat.com Ronald Sigal
            heruan-1 Giovanni Lovato (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: