• 
      

    Load static media from the correct location, to prevent caching issues.

    Review Request #8026 — Created March 3, 2016 and submitted — Latest diff uploaded

    Information

    Review Board
    release-2.6.x

    Reviewers

    We recently moved to a new Django Pipeline and Babel compiler for our
    static media, but were hitting caching problems when moving between
    branches, with other files being served up.
    
    While investigating the caching issue, we found that we were still
    loading static media from the app directories, and not from the
    directory containing the generated output (htdocs/static/). This meant
    the wrong files and the wrong mtimes were being considered.
    
    It's unclear why this was a new problem. The cause of the caching issue
    was that mtimes were being compared, and Git preserves mtimes for files
    when switching branches, even if the content changes. The server was
    sending Last-Modified headers containing these mtimes, and the browser
    was sending If-Modified-Since with the same mtimes. So the caching issue
    should have happened before, and perhaps it did but we didn't notice in
    practice (until now).
    
    Either way, switching the location fixes the caching issues, and is more
    correct.
    1. Cleared browser cache and removed htdocs/static/.
    2. Accessed /js-tests/ under release-2.5.x.
    3. Switched to the branch for this change (under release-2.6.x).
    4. Reloaded the page
    5. Saw that the new media was loading, rather than serving up the stale
      content (as before).

    I also verified through temporary logging statements in Django that we
    were now accessing from the correct path.