Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28709

Performance: Send cache/contenttype headers with 304 responses

    Details

      Description

      Apache is sending a max-age header of 1 second for image.php etc requests. This seems to be bug/confusion/bad configuration in apache that causes incorrect application of mod_expires rules before the content type is determined. (It does send the correct content-type to the browser, so there is some race here...)

      For us, this was trivially reproducible by loading any moodle page, then pressing F5 in the browser, which sends if-modified-since requests. The server then responds with a cache-control: max-age=1 header, triggering the browser to revalidate that resource on every future page load for at least the session.

      This can be worked around by sending the content-type and cache headers from moodle for 304 Not Modified responses, which also helps buggy browsers and caches to retain the content for longer since they may forget or drop old headers when a new request for that resource happens.

      The max-age and expires headers are made consistent, since according to the http spec, max-age will always override expires the difference seemed to be giving 10x too long expiry.

      github for 20_STABLE incoming...

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Oct/11