Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20071

HttpCache should Vary on the user hash

    XMLWordPrintable

Details

    • Aconcagua Sprint 1, Aconcagua Sprint 2
    • 3

    Description

      At the moment, HttpCache is completely public and only vary on the ETag, not on a user based information.

      To make the cache vary on the user hash (like it was the case in legacy), we need to rely on a custom Http request header (e.g. X-User-Hash).

      $response = new Response();
      $response->setVary( 'X-User-Hash' );
      

      To make this possible, we need to calculate and store this user hash somehow at login time, in a cookie for instance. Thus, the reverse proxy (Symfony one or Varnish) can extract it and set the custom request header in a very easy way.

      Solution

      • In user/login legacy module, compute the user hash when the user is logged in.
      • Trigger an user/login ezpEvent (filter type to be able to pass the computed user hash)
      • From Symfony, attach a listener to this event and make it set the cookie
      • In Symfony reverse proxy (HttpCache), catch the cookie if present and set the value in X-User-Hash request header before the lookup action.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jerome.vieilledent-obsolete@ez.no Jérôme Vieilledent (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 3 days Original Estimate - 3 days
                3d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 2 hours, 30 minutes
                4d 2h 30m