Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17028

Build status icons don't refresh due to Cache-Control setting in HTTP response

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      For our Netflix OSS projects, build status icons don't update in our GitHub pages unless we clear the browser cache. An example is at https://github.com/Netflix/RxJava

      I investigated with Michael Neale and we found that the HTTP response includes "Cache-Control:public", which is likely causing the problem. Michael verified that this problem doesn't happen with build status icons from BuildHive, because the HTTP rsponses from BuildHive don't include the Cache-Control setting.

      I looked at the plugin code to see if this was an easy fix, but it looks like the HTTP response is generated somewhere in the Stapler code, which I didn't want to mess with

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            src/main/java/org/jenkinsci/plugins/badge/BadgeAction.java
            src/main/java/org/jenkinsci/plugins/badge/BadgeActionFactory.java
            src/main/java/org/jenkinsci/plugins/badge/StatusImage.java
            http://jenkins-ci.org/commit/embeddable-build-status-plugin/1bac74e1e2e2780504a04779175456cc8a8bda6c
            Log:
            [FIXED JENKINS-17028]

            Some browsers appear to cache 302 requests in violation of RFC
            (I'm looking at you, Chrome: http://code.google.com/p/chromium/issues/detail?id=103458)

            I also saw this behavior with Firefox, even though I couldn't locate any
            bug report.

            Sine Chrome alone is a big enough browser share, in this change I
            modified the code to avoid 302 redirects and instead to service the
            request with 200.

            To avoid excessive data transfer, ETag is used to detect that the
            browser has the image in cache.

            Compare: https://github.com/jenkinsci/embeddable-build-status-plugin/compare/233087cbd8dc...1bac74e1e2e2


            You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
            For more options, visit https://groups.google.com/groups/opt_out.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/org/jenkinsci/plugins/badge/BadgeAction.java src/main/java/org/jenkinsci/plugins/badge/BadgeActionFactory.java src/main/java/org/jenkinsci/plugins/badge/StatusImage.java http://jenkins-ci.org/commit/embeddable-build-status-plugin/1bac74e1e2e2780504a04779175456cc8a8bda6c Log: [FIXED JENKINS-17028] Some browsers appear to cache 302 requests in violation of RFC (I'm looking at you, Chrome: http://code.google.com/p/chromium/issues/detail?id=103458 ) I also saw this behavior with Firefox, even though I couldn't locate any bug report. Sine Chrome alone is a big enough browser share, in this change I modified the code to avoid 302 redirects and instead to service the request with 200. To avoid excessive data transfer, ETag is used to detect that the browser has the image in cache. Compare: https://github.com/jenkinsci/embeddable-build-status-plugin/compare/233087cbd8dc...1bac74e1e2e2 – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .
            Hide
            rossc0 Ross Lawley added a comment -
            Show
            rossc0 Ross Lawley added a comment - According to Github you need to also set the Cache-Control header - see: https://github.com/github/markup/issues/224#issuecomment-33454537 Added https://github.com/jenkinsci/embeddable-build-status-plugin/pull/6
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            src/main/java/org/jenkinsci/plugins/badge/StatusImage.java
            http://jenkins-ci.org/commit/embeddable-build-status-plugin/e9ced649ebc212cbb3e2d3485517d3fc3e3a1012
            Log:
            [FIXED JENKINS-17028] Merge pull request #6 from rozza/JENKINS-17028

            Added Cache-Control: no-cache - refs

            Compare: https://github.com/jenkinsci/embeddable-build-status-plugin/compare/76463a6e8b4a...e9ced649ebc2

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/main/java/org/jenkinsci/plugins/badge/StatusImage.java http://jenkins-ci.org/commit/embeddable-build-status-plugin/e9ced649ebc212cbb3e2d3485517d3fc3e3a1012 Log: [FIXED JENKINS-17028] Merge pull request #6 from rozza/ JENKINS-17028 Added Cache-Control: no-cache - refs Compare: https://github.com/jenkinsci/embeddable-build-status-plugin/compare/76463a6e8b4a...e9ced649ebc2

              People

              • Assignee:
                kohsuke Kohsuke Kawaguchi
                Reporter:
                garethbowles garethbowles
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: