Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-8869

ResponseContentTypeVoter returns server default if request has no extension

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 6.2.34
    • None
    • None
    • None
    • DevX 35, DevX 36, DevX 37
    • 2
    • Yes

      ResponseContentTypeVoter uses the extension of request if none set, it uses the Magnolia server default extension, so when using a delivery endpoint, it is not cached because in falls into:

      /modules/cache/config/contentCaching/defaultPageCache/browserCachePolicy/policies/dontCachePages

      resolves as html and sets the no cache headers.

      code here:

      String defaultExtension = ServerConfiguration.getInstance().getDefaultExtension();

      in class info.magnolia.cms.beans.config.MIMEMapping

      I guess fixing this issue will make many installations work in a different way

      To reproduce just open this link https://demopublic.magnolia-cms.com/.rest/delivery/tours/v1

       ----------------------------------
      Development decision :
      Because ResponseContentTypeVoter was deprecated so we need to replace with RequestExtensionVoter which is a replacement for it (MGNLCACHE-290). And in order to make the class more configurable, we decided to add new flag named "emptyExtensionVote" to control this voter behavior in case of empty extension. Default value if not set is true (for backward compatibility). So in case of rest endpoint, if users want to cache it, they just need to add the flag to the dontCachePages voter and set its value to false.

        Acceptance criteria

              chuong.doan Chuong Doan Huy
              tmiyar Teresa Miyar
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved:
                Work Started:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 3d 3.5h
                    3d 3.5h