Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-7245

Add option to load static content from ContenDeliveryNetwork

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Medium Medium
    • dev.moodle.org
    • None

      Hi,

      I would like to improve loading speed of my moodle site and would like to add the option to load static content like images, js-files, css-files etc from a CDN like KeyCDN.

      See eg. https://www.keycdn.com/support/cdn-integration

      My general idea would be to include a new config setting like the following:

      $CFG->wwwcdnroot   = 'https://cdn.mysite.com';

      This new subdomain can then be linked via a DNS entry to the CDN provider or it could contain directly the corresponding cdn url like https://example-hexid.kxcdn.com

       

      One possible option I saw in the code was in lib\weblib.php in the constructor of moodle_url  to add a check like

      $pos = strpos($url, '.js');
      if ($pos !== false)

      {     $url = str_replace("$CFG->wwwroot/", "$CFG->wwwcdnroot/", $url); }

       

      What do you think?

      Currently I am using moodle 4.0.x, I can not go to a newer version as my hosting provider does not want/can not give me a newer MariaDB version which is required for updating moodle.

      Greetings

       

       

            Unassigned Unassigned
            joeft2020 Jo Ma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.