Moodle
  1. Moodle
  2. MDL-17976

Header expire not fully functional

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.9.3
    • Fix Version/s: None
    • Component/s: Performance
    • Labels:
      None
    • Environment:
      Apache
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      2292

      Description

      As reported by Yslow

      (no expires) moodle/theme/standard/styles.php
      (no expires) moodle/theme/standardwhite/styles.php
      (no expires) moodle/theme/standardlogo/styles.php
      (no expires) moodle/lib/overlib/overlib.js
      (no expires) moodle/lib/overlib/overlib_cssstyle.js
      (no expires) moodle/lib/cookies.js
      (no expires) moodle/lib/ufo.js
      (no expires) moodle/lib/dropdown.js
      (no expires) moodle/calendar/overlib.cfg.php
      (no expires) moodle/theme/standardlogo/logo.gif
      (no expires) moodle/mod/glossary/icon.gif
      (no expires) moodle/mod/resource/icon.gif
      (no expires) moodle/pix/i/user.gif
      (no expires) moodle/pix/i/course.gif
      (no expires) moodle/pix/i/item.gif
      (no expires) moodle/pix/i/closed.gif
      (no expires) moodle/pix/moodlelogo.gif
      (no expires) moodle/theme/standardwhite/gradient.jpg

      Above files does not contain a header. Somehow parts of Moodle is not respecting http://docs.moodle.org/en/Apache#Performance

      mod_expire is working for some parts of Moodle and for all static html pages so this issue has to be present in Moodle.

        Activity

        Hide
        Chris Plansky added a comment -

        Could this be related to the overlib issue that users have been experiencing? http://moodle.org/mod/forum/discuss.php?d=105826

        Show
        Chris Plansky added a comment - Could this be related to the overlib issue that users have been experiencing? http://moodle.org/mod/forum/discuss.php?d=105826
        Hide
        Stuart Chapman added a comment -

        The problem I have been experiencing whilst trying to make YSlow happy is that the max-age and expires headers are sometimes being set in the Moodle code and sometimes it is left for the server to set. Using mod_expires in Apache, it is possible to set sensible values for the majority of file types but the stylesheets (/theme/standard/styles.php and /theme/[theme name]/styles.php) and JavaScript (/lib/javascript-mod.php) are set in the Moodle code .

        It appears that improvements have been made to the stylesheets code with the introduction of $THEME->csslifetime but this isn't in MOODLE_19_WEEKLY so it's not possible to take advantage of this. The only thing I could find to resolve this was to change the value of $lifetime in my themes style.php, although the file says not to make any changes there. The lifetime is hard coded in javascript-mod.php.

        Would there be a problem with not setting the expiry headers in Moodle and allowing administrators to set the values they want at the web server level? I can see that setting them in the code has benefits if there are no expiry directives on the web server as any expires values are better than nothing.

        Maybe this should be a separate issue, but would it not be possible to derive a hash from the files which were being merged by the above files and append that as a query string, allowing the file to be cached indefinitely as the hash would change when any of the files did, causing the script to be requested again.

        Show
        Stuart Chapman added a comment - The problem I have been experiencing whilst trying to make YSlow happy is that the max-age and expires headers are sometimes being set in the Moodle code and sometimes it is left for the server to set. Using mod_expires in Apache, it is possible to set sensible values for the majority of file types but the stylesheets (/theme/standard/styles.php and /theme/ [theme name] /styles.php) and JavaScript (/lib/javascript-mod.php) are set in the Moodle code . It appears that improvements have been made to the stylesheets code with the introduction of $THEME->csslifetime but this isn't in MOODLE_19_WEEKLY so it's not possible to take advantage of this. The only thing I could find to resolve this was to change the value of $lifetime in my themes style.php, although the file says not to make any changes there. The lifetime is hard coded in javascript-mod.php. Would there be a problem with not setting the expiry headers in Moodle and allowing administrators to set the values they want at the web server level? I can see that setting them in the code has benefits if there are no expiry directives on the web server as any expires values are better than nothing. Maybe this should be a separate issue, but would it not be possible to derive a hash from the files which were being merged by the above files and append that as a query string, allowing the file to be cached indefinitely as the hash would change when any of the files did, causing the script to be requested again.
        Hide
        Petr Škoda added a comment -

        This should bi finally resolved in latest 2.3dev, thanks for the report!

        Show
        Petr Škoda added a comment - This should bi finally resolved in latest 2.3dev, thanks for the report!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: