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

ReverseProxySetupMonitor seems not to be working with mod_jk and no reverse proxy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core
    • None

      Some commenters in
      https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+says+my+reverse+proxy+setup+is+broken
      complain that when using mod_jk and no reverse proxy, the reverse proxy check does not work correctly. I am experiencing this too.

      I ran the test suggested on that page and got these results

      % curl -iL -e http://jenkins.example.com/manage http://jenkins.example.com/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test
      HTTP/1.1 302 Found
      Date: Thu, 08 Oct 2015 00:32:40 GMT
      Server: Apache
      Location: http://jenkins.example.com/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/testForReverseProxySetup/http%3A%2F%2Fjenkins.example.com%2Fmanage/
      Content-Length: 0
      
      HTTP/1.1 404 http://jenkins.example.com/manage vs. http:%2F%2Fjenkins.example.com%2Fmanage
      Date: Thu, 08 Oct 2015 00:32:40 GMT
      Server: Apache
      Cache-Control: must-revalidate,no-cache,no-store
      Content-Length: 1646
      Content-Type: text/html;charset=ISO-8859-1
      
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
      <title>Error 404 http://jenkins.example.com/manage vs. http:%2F%2Fjenkins.example.com%2Fmanage</title>
      </head>
      <body><h2>HTTP ERROR 404</h2>
      <p>Problem accessing /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/testForReverseProxySetup/http:%252F%252Fjenkins.example.com%252Fmanage/. Reason:
      <pre>    http://jenkins.example.com/manage vs. http:%2F%2Fjenkins.example.com%2Fmanage</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      
      </body>
      </html>
      
      With this configuration
      
      

      The config is

      /etc/libapache2-mod-jk/workers.properties:
      
      workers.tomcat_home=/var/lib/tomcat7
      workers.java_home=/usr/lib/jvm/java-1.7.0-openjdk-amd64
      ps=/
      worker.list=jenkins_worker
      worker.jenkins_worker.port=9009
      worker.jenkins_worker.host=jenkins.example.com
      worker.jenkins_worker.type=ajp13
      
      /etc/apache2/sites-enabled/jenkins.example.com:
      
      <VirtualHost *:80>
              ServerName      jenkins.example.com
              ServerAlias     jenkins-int.example.com
              ServerAdmin     web@example.com
              ServerSignature Off
              AllowEncodedSlashes NoDecode
              JkMount       /*   jenkins_worker
              JkLogLevel          info
              JkRequestLogFormat  "%w %V %T"
              JkLogStampFormat    "[%a %b %d %H:%M:%S %Y] "
              JkLogFile           /var/log/apache2/vhosts/jenkins.example.com/mod_jk.log
      
              LogLevel warn
              CustomLog    /var/log/apache2/vhosts/jenkins.example.com/access.log  backend_vhost
              ErrorLog     /var/log/apache2/vhosts/jenkins.example.com/error.log
      </VirtualHost>
      
      /etc/apache2/mods-enabled/jk.conf:
      
      <IfModule jk_module>
          JkWorkersFile /etc/libapache2-mod-jk/workers.properties
          JkLogFile /var/log/apache2/mod_jk.log
          JkLogLevel info
          JkShmFile /var/log/apache2/jk-runtime-status
          JkWatchdogInterval 60
          <Location /jk-status>
              JkMount jk-status
              Order deny,allow
              Deny from all
              Allow from 127.0.0.1
          </Location>
          <Location /jk-manager>
              JkMount jk-manager
              Order deny,allow
              Deny from all
              Allow from 127.0.0.1
          </Location>
      </IfModule>
      
      /etc/default/jenkins:
      
      NAME=jenkins
      JAVA=/usr/bin/java
      JAVA_ARGS="-Djava.awt.headless=true"  # Allow graphs etc. to work even when an X server is present
      JAVA_ARGS="$JAVA_ARGS -Dhudson.DNSMultiCast.disabled=true"
      PIDFILE=/var/run/jenkins/jenkins.pid
      JENKINS_USER=jenkins
      JENKINS_GROUP=jenkins
      JENKINS_WAR=/usr/share/jenkins/jenkins.war
      JENKINS_HOME=/var/lib/jenkins
      RUN_STANDALONE=true
      JENKINS_LOG=/var/log/jenkins/$NAME.log
      MAXOPENFILES=8192
      HTTP_PORT=-1
      AJP_PORT=9009
      PREFIX=/jenkins
      HTTP_ADDR=127.0.0.1
      JENKINS_ARGS="--webroot=/var/cache/jenkins/war -httpListenAddress=$HTTP_ADDR --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
      
      

      In the jenkins /configure page, the URL is http://jenkins.example.com/

            Unassigned Unassigned
            xipmox Vince Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: