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

As a developer I want to be able to set different TTL for "temporary" status codes

    Details

      Description

      Currently, if TTL cache is enabled, eZ Platform sets the s-maxage header equal to "default_ttl" option on all responses. Their status code is not taken into the account.

      However, there should be an option to set different s-maxage header for the responses with "temporary" status codes, such as 302 or 500 (and possibly others).

      There should either be an option to set custom s-maxage header on a given route so it does not use default TTL, or there should be a change to the code setting s-maxage header so it sets different TTL for the set of known "temporary" status codes.

      The code responsible for setting the header can be found here: https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Bundle/EzPublishCoreBundle/EventListener/CacheViewResponseListener.php#L70.

      This task was created as a result of a Customer Request (CS-6270).

        Issue Links

          Activity

          Hide
          André Rømcke added a comment - - edited

          This issue is about to be solved in 1.12, the solution so far is using plain FOSHTTPCache config which allows developers to control this if needed:

          fos_http_cache:
              cache_control:
                  rules:
                      # Make sure already cacheable (fresh) responses from eZ Platform which are errors/redirect gets lower ttl (then default_ttl)
                      -
                          match:
                              match_response: "response.isFresh() && ( response.isServerError() || response.isClientError() || response.isRedirect() )"
                          headers:
                              overwrite: true
                              cache_control:
                                  max_age: 10
          

          For previous releases this would need to be added to documentation both for 5.4, and 1.7 and up.

          Show
          André Rømcke added a comment - - edited This issue is about to be solved in 1.12 , the solution so far is using plain FOSHTTPCache config which allows developers to control this if needed: fos_http_cache: cache_control: rules: # Make sure already cacheable (fresh) responses from eZ Platform which are errors/redirect gets lower ttl (then default_ttl) - match: match_response: "response.isFresh() && ( response.isServerError() || response.isClientError() || response.isRedirect() )" headers: overwrite: true cache_control: max_age: 10 For previous releases this would need to be added to documentation both for 5.4, and 1.7 and up.
          Show
          André Rømcke added a comment - Fixed in https://github.com/ezsystems/ezplatform/commit/45f552a3e7b689f0ff0978ccb85f0e83d07129c5 Doc will be handled in: EZP-25922

            People

            • Assignee:
              Unassigned
              Reporter:
              Jacek Foremski (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: