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

Disable buffers in nginx when NO_OUTPUT_BUFFERING is on

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Install moodle under an nginx instance with buffering on. View any page that a progress bar and it should smoothly progress.

      A minimal test case progress bar can be found here:

      https://github.com/brendanheywood/moodle-tool_heartbeat/blob/master/progress.php

      Install that plugin, then load the page. It should show a status update every second and complete in 5 seconds. Under nginx it just appears at 100% after 5 seconds.

      Show
      Install moodle under an nginx instance with buffering on. View any page that a progress bar and it should smoothly progress. A minimal test case progress bar can be found here: https://github.com/brendanheywood/moodle-tool_heartbeat/blob/master/progress.php Install that plugin, then load the page. It should show a status update every second and complete in 5 seconds. Under nginx it just appears at 100% after 5 seconds.
    • Workaround:
      Hide

      Manually mess with nginx buffer config

      Show
      Manually mess with nginx buffer config
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-57810-nginx-buffers

      Description

      For pages which define:

      define('NO_OUTPUT_BUFFERING', true);

      This may not work by default under nginx which adds an additional layer of buffering. Instead of requiring nginx config changes we can just send this header when needed:

      header('X-Accel-Buffering: no');

      See also: https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/#x-accel-buffering

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brendanheywood Brendan Heywood
                Reporter:
                brendanheywood Brendan Heywood
                Peer reviewer:
                Matt Porritt
                Integrator:
                Dan Poltawski
                Tester:
                Dan Poltawski
                Participants:
                Component watchers:
                Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Mar/17