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

Project icon not displayed behind a reverse proxy

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core, scm-api-plugin
    • None
    • Jenkins 2.60.2
      Bitbucket Branch Source Plugin 2.2.2
      Firefox 54.0.10

      Hi,

      The project icon is not displayed behind a reverse proxy :

      But everything is fine if i go directly to the Jetty server :

      The URL used by the image behind the reverse proxy is :

      https://myreverseproxy.com:80/jenkins/avatar-cache/36a6926eafd8be29f65892cf8ba6774f.png?size=32x32
      

      But :80 must not be there :

      https://myreverseproxy.com/jenkins/avatar-cache/36a6926eafd8be29f65892cf8ba6774f.png?size=32x32
      

      For info, my reverse proxy is an Apache 2.4 with SSL enabled and Jenkins is behind a Jetty 9.4 without SSL. Here is the config on my reverse proxy for Apache :

      ProxyPass /jenkins http://myjetty.com:8080/jenkins
      ProxyPassReverse /jenkins http://myjetty.com:8080/jenkins
      <Location /jenkins>
          Order allow,deny
          Allow from all
      </Location>
      

          [JENKINS-45802] Project icon not displayed behind a reverse proxy

          I have the same issue. The icon does not get loaded from Bitbucket Server, but it exists. The image source loads the default logo via http instead of https:

          <img src="http://<jenkins>/avatar-cache/972b29bb7d99e4cf0f79654daef976e8.png?size=32x32" alt="Bitbucket Team/Project" tooltip="Bitbucket Team/Project" class="icon-lg" title="Bitbucket Team/Project">

          Raphael Pionke added a comment - I have the same issue. The icon does not get loaded from Bitbucket Server, but it exists. The image source loads the default logo via http instead of https: <img src="http://<jenkins>/avatar-cache/972b29bb7d99e4cf0f79654daef976e8.png?size=32x32" alt="Bitbucket Team/Project" tooltip="Bitbucket Team/Project" class="icon-lg" title="Bitbucket Team/Project">

          Nikolas Falco added a comment -

          Is this bug still present with latest plugin version?

          Nikolas Falco added a comment - Is this bug still present with latest plugin version?

          Nikolas Falco added a comment -

          The AvatarCache class in scm-api plugin compose the avatar URL using Jenkins.getRootUrlFromRequest() where the http port is gather from the request or by the X-Forwarded-Port header if present.
          By default Jenkins.class add the port if is not default. In this case maybe something misconfigured in you reverse proxy (I see https and port 80) or the issue has already fixed in Jenkins core.

                  String forwardedPort = getXForwardedHeader(req, "X-Forwarded-Port", null);
                  if (forwardedPort != null) {
                      try {
                          port = Integer.parseInt(forwardedPort);
                      } catch (NumberFormatException e) {
                          // ignore
                      }
                  }
                  if (port != ("https".equals(scheme) ? 443 : 80)) {
                      buf.append(':').append(port);
                  }
          

          Let's me change the component to scm-api and jenkins-core

          Nikolas Falco added a comment - The AvatarCache class in scm-api plugin compose the avatar URL using Jenkins.getRootUrlFromRequest() where the http port is gather from the request or by the X-Forwarded-Port header if present. By default Jenkins.class add the port if is not default. In this case maybe something misconfigured in you reverse proxy (I see https and port 80) or the issue has already fixed in Jenkins core. String forwardedPort = getXForwardedHeader(req, "X-Forwarded-Port" , null ); if (forwardedPort != null ) { try { port = Integer .parseInt(forwardedPort); } catch (NumberFormatException e) { // ignore } } if (port != ( "https" .equals(scheme) ? 443 : 80)) { buf.append( ':' ).append(port); } Let's me change the component to scm-api and jenkins-core

            nfalco Nikolas Falco
            crazymax Maxime KILT
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: