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

Timestamper panel is not displayed because of mixed content block

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • timestamper-plugin
    • None
    • Jenkins 2.7
      Chrome 51.0
      Timestamper 1.8.2

      When Jenkins is running behind HTTPS proxy, some JavaScript files cannot be loaded.

      Please notice that this issue disappears if I downgrade Timestamper to version 1.7.4.

          [JENKINS-35315] Timestamper panel is not displayed because of mixed content block

          Steven G Brown added a comment - Annotator.js is being served here: https://github.com/jenkinsci/timestamper-plugin/blob/timestamper-1.8.2/src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java#L131 Any idea what the problem is or how it should be fixed?

          Pavel Jozef added a comment - - edited

          So the browser is trying to make the following request:

          https://my.jenkins.host/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory2/script.js
          

          Jenkins responds with a temporary redirect:

          location:http://my.jenkins.host/static/1.8.2/plugin/timestamper/annotator.js
          status:302
          

          It looks like `doScriptJs` generates an absolute HTTP URL.

          What does req.getContextPath() return? Most likely this issue is caused by sendRedirect2.

          Pavel Jozef added a comment - - edited So the browser is trying to make the following request: https://my.jenkins.host/extensionList/hudson.console.ConsoleAnnotatorFactory/hudson.plugins.timestamper.annotator.TimestampAnnotatorFactory2/script.js Jenkins responds with a temporary redirect: location:http://my.jenkins.host/static/1.8.2/plugin/timestamper/annotator.js status:302 It looks like `doScriptJs` generates an absolute HTTP URL. What does req.getContextPath() return? Most likely this issue is caused by sendRedirect2.

          Code changed in jenkins
          User: Steven Brown
          Path:
          src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java
          http://jenkins-ci.org/commit/timestamper-plugin/6ed19b1c8686c6dfa92fa1c08e1e5c3bcda1cda8
          Log:
          JENKINS-35315 Give browser relative URL for redirect to annotator.js

          The code previously used the sendRedirect method, which resolves the relative
          URL to an absolute URL within the servlet container and so gives the wrong
          result when running behind a proxy.

          http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Brown Path: src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java http://jenkins-ci.org/commit/timestamper-plugin/6ed19b1c8686c6dfa92fa1c08e1e5c3bcda1cda8 Log: JENKINS-35315 Give browser relative URL for redirect to annotator.js The code previously used the sendRedirect method, which resolves the relative URL to an absolute URL within the servlet container and so gives the wrong result when running behind a proxy. http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String )

          Fix is included in Timestamper 1.8.3, available shortly. Could you give it a try?

          Steven G Brown added a comment - Fix is included in Timestamper 1.8.3, available shortly. Could you give it a try?

          Pavel Jozef added a comment -

          Fixed in version 1.8.3.

          Thank you!

          Pavel Jozef added a comment - Fixed in version 1.8.3. Thank you!

          Code changed in jenkins
          User: Steven Brown
          Path:
          src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java
          src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/script.js
          src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/style.css
          src/main/webapp/annotator.js
          src/main/webapp/style.css
          http://jenkins-ci.org/commit/timestamper-plugin/bb7e2ce76a86127ffa3de95a4aec9d6419a38412
          Log:
          JENKINS-38085 Revert to default way of loading the script and CSS

          A custom approach was previously used to load the script and CSS for displaying
          the timestamps. It caused the script and CSS to be reloaded when the Timestamper
          plugin is upgraded or downgraded, rather than being cached for the next day.

          It seems this doesn't work for everyone (JENKINS-38085), so I'm reverting back
          to the default behaviour. Note that it is known to work with HTTPS and through a
          HTTPS proxy (JENKINS-35315) at least for some users.

          As a result, the TimestampAnnotatorFactory class will have to be manually
          renamed each time the script or CSS is changed in a new release.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Brown Path: src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/script.js src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/style.css src/main/webapp/annotator.js src/main/webapp/style.css http://jenkins-ci.org/commit/timestamper-plugin/bb7e2ce76a86127ffa3de95a4aec9d6419a38412 Log: JENKINS-38085 Revert to default way of loading the script and CSS A custom approach was previously used to load the script and CSS for displaying the timestamps. It caused the script and CSS to be reloaded when the Timestamper plugin is upgraded or downgraded, rather than being cached for the next day. It seems this doesn't work for everyone ( JENKINS-38085 ), so I'm reverting back to the default behaviour. Note that it is known to work with HTTPS and through a HTTPS proxy ( JENKINS-35315 ) at least for some users. As a result, the TimestampAnnotatorFactory class will have to be manually renamed each time the script or CSS is changed in a new release.

            stevengbrown Steven G Brown
            pavel_paulau Pavel Jozef
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: